diff --git a/gadjo/static/js/gadjo.js b/gadjo/static/js/gadjo.js index 9b66d48..bc712f9 100644 --- a/gadjo/static/js/gadjo.js +++ b/gadjo/static/js/gadjo.js @@ -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) {