Commit 9cfc44c
t18: A11y + dismissal polish for the mobile nav
The mobile nav was a single signal-driven flyout with no accessibility
affordances and no dismissal paths beyond clicking the hamburger
again. Add the missing pieces a screen reader / keyboard user
expects:
* Hamburger button now exposes `aria-expanded` (bound to the
`menu_open` signal), `aria-controls` pointing at the flyout's
new `id="primary-mobile-nav"`, and a dynamic `aria-label` that
flips between "Open menu" / "Close menu".
* Both `<nav>` regions get `aria-label="Primary"` so assistive
tech can name them.
* The active-route detection that already drives the
`odp-header-btn-active` styling now also emits
`aria-current="page"` on the matching `<A>`.
* Pressing **Escape** while the flyout is open closes it
(`window_event_listener(ev::keydown, ...)`).
* Clicking outside the flyout closes it -- a transparent backdrop
`<div class="fixed inset-0 z-40 lg:hidden">` is rendered when
the menu is open and dismisses on click. Flyout sits on `z-50`
so it stays above the backdrop.
* Tapping any link inside the flyout closes it. `NavButton` and
`ExternalNavButton` gained an optional
`on_navigate: Option<Callback<()>>` prop that fires from the
underlying `on:click`; the call sites in the mobile nav pass a
closure that flips `menu_open` to `false`. Desktop nav passes
no callback so its behaviour is unchanged.
* `ExternalNavButton` now sets `rel="noopener noreferrer"` to
fix the long-standing reverse-tabnabbing risk on the Library
link.
The desktop / mobile breakpoint switch (now at `lg` after t15) is
left in place. The plan's "compact nav at lg, full nav at xl" idea is
intentionally skipped: with the current label lengths the full nav
fits cleanly at `lg` and a separate icon-only ladder would add
maintenance burden without a real visual win.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0295f24 commit 9cfc44c
1 file changed
Lines changed: 59 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
| |||
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
32 | | - | |
| 44 | + | |
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
| |||
40 | 52 | | |
41 | 53 | | |
42 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
43 | 63 | | |
44 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
45 | 67 | | |
46 | 68 | | |
47 | | - | |
48 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
49 | 76 | | |
50 | 77 | | |
51 | 78 | | |
52 | 79 | | |
| 80 | + | |
53 | 81 | | |
54 | | - | |
55 | | - | |
| 82 | + | |
| 83 | + | |
56 | 84 | | |
57 | 85 | | |
58 | 86 | | |
59 | 87 | | |
60 | 88 | | |
61 | 89 | | |
62 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
63 | 96 | | |
64 | 97 | | |
65 | 98 | | |
| |||
71 | 104 | | |
72 | 105 | | |
73 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
74 | 113 | | |
75 | 114 | | |
76 | 115 | | |
77 | 116 | | |
78 | 117 | | |
79 | 118 | | |
80 | 119 | | |
81 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
82 | 126 | | |
83 | 127 | | |
84 | 128 | | |
| |||
87 | 131 | | |
88 | 132 | | |
89 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
90 | 140 | | |
91 | 141 | | |
92 | 142 | | |
| |||
0 commit comments