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"; const showClass = "navbar__links--show";
navbarLinks.classList.toggle(showClass); navbarLinks.classList.toggle(showClass);
if (navbarToggle.getAttribute("aria-expanded") === "false") { if (navbarToggle.ariaExpanded === "false") {
navbarToggle.setAttribute("aria-expanded", "true"); navbarToggle.ariaExpanded = "true";
} else { } else {
navbarToggle.setAttribute("aria-expanded", "false"); navbarToggle.ariaExpanded = "false";
} }
}); });
</script> </script>