Skip to content
Snippets Groups Projects
Commit 7a26f7ec authored by alexisben's avatar alexisben
Browse files

a11y on main menu

parent ad1960a7
No related branches found
No related tags found
No related merge requests found
......@@ -47,9 +47,16 @@ class MainMenu {
document.documentElement.classList.toggle(CLASSES.menusOpened);
}
toggleDropdown (button) {
const isExpanded = button.getAttribute('aria-expanded') === 'true';
button.setAttribute('aria-expanded', !isExpanded);
toggleDropdown (clickedButton) {
const isExpanded = clickedButton.getAttribute('aria-expanded') === 'true';
// Close all dropdowns except selected
this.dropdownsButtons.forEach(button => {
if (clickedButton === button) {
clickedButton.setAttribute('aria-expanded', !isExpanded);
} else {
button.setAttribute('aria-expanded', 'false');
}
});
}
onScroll () {
......
......@@ -46,8 +46,8 @@
display: block
&:last-child a
padding-right: 0
li.has-children:hover
.dropdown-menu
li.has-children
a[aria-expanded="true"] + .dropdown-menu
display: block
.nav-level-2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment