diff --git a/bookwyrm/static/js/shared.js b/bookwyrm/static/js/shared.js index 3cb85d110..de6d44f99 100644 --- a/bookwyrm/static/js/shared.js +++ b/bookwyrm/static/js/shared.js @@ -17,6 +17,10 @@ window.onload = function() { .forEach(t => t.onclick = tabChangeNested); Array.from(document.getElementsByClassName('tab-change')) .forEach(t => t.onclick = tabChange); + + // handle aria settings on menus + Array.from(document.getElementsByClassName('pulldown-menu')) + .forEach(t => t.onclick = toggleMenu); }; function toggleAction(e) { @@ -71,7 +75,8 @@ function handleTabChange(target, parentElement) { target.className = 'is-active'; } -function toggleMenu(el) { +function toggleMenu(e) { + var el = e.target.closest('.pulldown-menu'); el.setAttribute('aria-expanded', el.getAttribute('aria-expanded') == 'false'); } diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index e625343b3..7a09f60dd 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -41,7 +41,7 @@ -