a11y: add keyboard navigation for extra actions menu opener (#68301)
This commit is contained in:
parent
ba02d038f7
commit
ad04de1273
|
@ -492,10 +492,28 @@ var gadjo_js = gadjo_js || {};
|
|||
}
|
||||
});
|
||||
$(function() {
|
||||
$('#main-content').on('click', 'a.extra-actions-menu-opener', function() {
|
||||
$(document.querySelectorAll('.extra-actions-menu')).each(function(i, el) {
|
||||
this.setAttribute('id', 'extra-actions-menu');
|
||||
});
|
||||
$(document.querySelectorAll('.extra-actions-menu-opener')).each(function(i, el) {
|
||||
this.setAttribute('tabindex', 0);
|
||||
this.setAttribute('aria-label', 'Menu'); // XXX: translation
|
||||
this.setAttribute('aria-controls', 'extra-actions-menu');
|
||||
this.setAttribute('aria-expanded', 'false');
|
||||
this.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
$(this).toggleClass('open');
|
||||
$('.extra-actions-menu').toggleClass('open');
|
||||
this.setAttribute('aria-expanded', $(this).is('.open'));
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
this.addEventListener('click', function() {
|
||||
$(this).toggleClass('open');
|
||||
$('.extra-actions-menu').toggleClass('open');
|
||||
this.setAttribute('aria-expanded', $(this).is('.open'));
|
||||
});
|
||||
});
|
||||
});
|
||||
$(function() {
|
||||
$(document).on('click auxclick', '.clickable-rows tr', function(event) {
|
||||
|
|
Loading…
Reference in New Issue