Skip to content

Commit

Permalink
fix: remove aria-expanded attribute from section tag in search result…
Browse files Browse the repository at this point in the history
… page
  • Loading branch information
smansouri committed Jun 26, 2023
1 parent e1212bc commit 88daf87
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/navigation.js
Expand Up @@ -2,12 +2,10 @@ import { ESCAPE } from "./Keys";

function toggleNavigation(toggle, menu) {
const isExpanded = menu.getAttribute("aria-expanded") === "true";
menu.setAttribute("aria-expanded", !isExpanded);
toggle.setAttribute("aria-expanded", !isExpanded);
}

function closeNavigation(toggle, menu) {
menu.setAttribute("aria-expanded", false);
function closeNavigation(toggle) {
toggle.setAttribute("aria-expanded", false);
toggle.focus();
}
Expand All @@ -26,7 +24,7 @@ window.addEventListener("DOMContentLoaded", () => {
menuList.addEventListener("keyup", (event) => {
if (event.keyCode === ESCAPE) {
event.stopPropagation();
closeNavigation(menuButton, menuList);
closeNavigation(menuButton);
}
});

Expand All @@ -47,7 +45,7 @@ window.addEventListener("DOMContentLoaded", () => {
element.addEventListener("keyup", (event) => {
console.log("escape");
if (event.keyCode === ESCAPE) {
closeNavigation(toggle, element);
closeNavigation(toggle);
}
});
});
Expand Down

0 comments on commit 88daf87

Please sign in to comment.