Skip to content

Commit 39e6155

Browse files
committed
Improve aria labels for navigation
1 parent 896f714 commit 39e6155

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

dev/resources/lang/en/strings.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
// Navigation
3535
'close' => 'Close',
3636
'menu' => 'Menu',
37+
'nav_close' => 'Close navigation',
38+
'nav_open' => 'Open navigation',
39+
'subnav_close' => 'Close sub navigation',
40+
'subnav_open' => 'Open sub navigation',
3741
'skip_to_content' => 'Skip to content',
3842

3943
// Other

dev/resources/views/navigation/_main_desktop.antlers.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"
1818
{{ if children }}
1919
href="#"
20+
:aria-label="
21+
subnavOpen
22+
? '{{ trans:strings.subnav_close }}'
23+
: '{{ trans:strings.subnav_open }}'
24+
"
2025
@click.prevent="subnavOpen = !subnavOpen"
2126
{{ else }}
2227
href="{{ url }}"

dev/resources/views/navigation/_main_mobile.antlers.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
<button
1010
@click.prevent="mobileNavOpen = !mobileNavOpen"
1111
class="fixed bottom-0 right-0 z-20 flex items-center justify-center w-16 h-16 mr-8 text-xs font-bold text-white mb-safe bg-primary"
12-
aria-label="Toggle menu"
12+
:aria-label="
13+
mobileNavOpen
14+
? '{{ trans:strings.nav_close }}'
15+
: '{{ trans:strings.nav_open }}'
16+
"
1317
x-text="mobileNavOpen ? '{{ trans:strings.close }}' : '{{ trans:strings.menu }}'"
1418
></button>
1519

@@ -32,6 +36,11 @@
3236
href="#"
3337
@click.prevent="mobileNavSubnavOpen = !mobileNavSubnavOpen"
3438
@click.outside="mobileNavSubnavOpen = false"
39+
:aria-label="
40+
mobileNavSubnavOpen
41+
? '{{ trans:strings.subnav_close }}'
42+
: '{{ trans:strings.subnav_open }}'
43+
"
3544
{{ else }}
3645
href="{{ url }}"
3746
{{ /if }}

0 commit comments

Comments
 (0)