misc: add button role to popup links (#78150)

This commit is contained in:
Frédéric Péters 2023-06-04 10:58:59 +02:00
parent 7d266a4a99
commit 2c312e5e79
1 changed files with 7 additions and 0 deletions

View File

@ -59,6 +59,13 @@ function displayPopup(event)
}
$(function() {
$('a[rel=popup], a[data-popup]').attr('role', 'button');
$('a[rel=popup], a[data-popup]').on('keydown', function(ev) {
if (ev.keyCode == 13 || ev.keyCode == 32) { // enter || space
$(this).trigger('click');
return false;
}
});
$('a[rel=popup], a[data-popup]').click(displayPopup);
$(document).on('wcs:dialog-loaded', function(e, dialog) {
if ($(dialog).find('[name$=add_element]').length) {