Refactor aria-expanded attribute check

This commit is contained in:
Helen Chong 2024-06-08 00:29:11 +08:00
parent 1bc88b6c95
commit 4ef8ebd499
1 changed files with 3 additions and 3 deletions

View File

@ -96,10 +96,10 @@
const showClass = "navbar__links--show";
navbarLinks.classList.toggle(showClass);
if (navbarToggle.getAttribute("aria-expanded") === "false") {
navbarToggle.setAttribute("aria-expanded", "true");
if (navbarToggle.ariaExpanded === "false") {
navbarToggle.ariaExpanded = "true";
} else {
navbarToggle.setAttribute("aria-expanded", "false");
navbarToggle.ariaExpanded = "false";
}
});
</script>