Skip to content

Commit 58cddbd

Browse files
committed
feat: add aria-label to hamburger
1 parent 6c56fb4 commit 58cddbd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/Navbar.astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const links = [
4545
class="relative md:hidden"
4646
aria-expanded="false"
4747
aria-controls="mobile-nav-content"
48+
aria-label="Open menu"
4849
>
4950
<div
5051
class="mobile-nav-bg bg-transparent inset-0 absolute rounded-full -z-10"
@@ -119,6 +120,9 @@ const links = [
119120
button.addEventListener("click", () => {
120121
const expanded = button.getAttribute("aria-expanded") === "true";
121122
button.setAttribute("aria-expanded", `${!expanded}`);
123+
expanded
124+
? button.setAttribute("aria-label", "Open menu")
125+
: button.setAttribute("aria-label", "Close menu");
122126
mobileNav.setAttribute("data-open", `${!expanded}`);
123127
});
124128
</script>

0 commit comments

Comments
 (0)