Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Accessibility: Popovers to be closed with a keyboard and visible to screeenreaders

gemnijmegenmdbpro pro asked 6 years ago


Popovers - we would like a closing button to be serviced with a keyboard and that it is possible to close it with the 'escape' key. The closing button should also be visible to screenreaders. popovers

Piotr Glejzer staff answered 6 years ago


Hi, Can you try this JavaScript code?
$(function () {

$('[data-toggle="popover"]').popover()

$(document).keyup(function (event) {

if (event.which === 27) {

$('[data-toggle="popover"]').popover('hide');

}

})

})
Best,
Piotr

Jean-Claude Paré free commented 1 year ago

(Still) works fine with Bootstrap 5.3.0. Thanks!

JC



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.9
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: Yes