Fix navigation menu's aria-expanded attribute when closed with Escape key

This commit is contained in:
Helen Chong 2024-06-14 03:01:14 +08:00
parent 6bbb230f1f
commit 1614230583
1 changed files with 1 additions and 0 deletions

View File

@ -145,6 +145,7 @@ https://kalechips.net/projects/snippets/burger #}
const key = event.code; const key = event.code;
if (key == "Escape") { if (key == "Escape") {
navbarBurger.removeAttribute("open"); navbarBurger.removeAttribute("open");
navbarBurger.ariaExpanded = false;
document.querySelector(".navbar__toggle").focus(); document.querySelector(".navbar__toggle").focus();
} }
}); });