From 1bc88b6c951b4756c50c9eab32a86e04d5b19fd8 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:24:58 +0800 Subject: [PATCH] Check aria-expanded value instead of class name to toggle the attribute of navigation toggle button --- src/_includes/global/navbar.njk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_includes/global/navbar.njk b/src/_includes/global/navbar.njk index da709c16..d168f2f0 100644 --- a/src/_includes/global/navbar.njk +++ b/src/_includes/global/navbar.njk @@ -96,7 +96,7 @@ const showClass = "navbar__links--show"; navbarLinks.classList.toggle(showClass); - if (navbarLinks.classList.contains(showClass)) { + if (navbarToggle.getAttribute("aria-expanded") === "false") { navbarToggle.setAttribute("aria-expanded", "true"); } else { navbarToggle.setAttribute("aria-expanded", "false");