Hi (:
I first have a small correction to my initial ticket:
When I wrote: “I have an issue in which a Video widget has Lightbox enabled, and when I TAB to it (so the Play button gets focus) and then press Enter/Space key, it doesn’t start playing.“, instead of “it doesn’t start playing” it should have been “the lightbox is not being open“.
Well, I did a conflict test and deactivated all plugins, but the issue still occurred, so it was not a plugin conflict. I then reviewed my custom jQuery code in child theme’s functions.php and saw I’ve previously added some code to make all buttons accessible, like this:
// Add keyboard support for all buttons, so they react to both Enter & Space keys:
$('*[role=button]').keydown(function (e) {
if ((e.key == 'Enter') || (e.key == ' ')) {
e.preventDefault();
setTimeout(function () {
$(this).click();
}, 300);
}
});
// Some more code here to fix focus handling on Click event...
When I changed it like so (i.e. added the if statement below) the issue was fixed:
// Add keyboard support for all buttons, so they react to both Enter & Space keys:
$('*[role=button]').keydown(function (e) {
if ((e.key == 'Enter') || (e.key == ' ')) {
e.preventDefault();
if ($(this).hasClass('elementor-custom-embed-play') &&
$(this).closest('.elementor-wrapper').hasClass('elementor-open-lightbox')) {
let current_button = $(this);
setTimeout(function () {
current_button.click();
}, 300);
}
else {
setTimeout(function () {
$(this).click();
}, 300);
}
}
});
// Some more code here to fix focus handling on Click event...
I hope it helps someone.
-
This reply was modified 43 minutes ago by thwp.