Specify element to focus when glightbox is closed? #371
stephenmeehanuk
started this conversation in
General
Replies: 1 comment 1 reply
-
|
I've had another look at the docs, I'm trying to do something like this, but it's not working... import GLightbox from "glightbox";
var lightbox = GLightbox();
lightbox.on('close', () => {
console.log(`Modal close`);
function setFocus() {
document.getElementById("glight_box").focus();
}
});I've added The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
Is it possible to specify an element that gets focus when the light-box is closed?
I'm doing some accessibility testing, and I've noticed when using the keyboard I can tab to the light-box trigger, press enter to open the light-box. But when I press esc or close the light-box by clicking
gclose gbtnthe focus defaults tobodyThis means keyboard users have to navigate back to the trigger button and beyond to continue navigating the website.
Is there a way to configure
glightboxso when the light-box is closedgclose gbtnreceives focus?Hope that makes sense.
Beta Was this translation helpful? Give feedback.
All reactions