Commit e1352de
fix(nav): focus search input when mobile menu opens (#523)
Code review of #518 found that moving the search box to the top of the
mobile menu (visually) left keyboard/screen-reader focus order
unchanged: Tab still traverses the whole nav list before reaching
search, since DOM order wasn't touched, only CSS position. That's now
inconsistent with the new visual order.
Focus the search input as soon as the mobile menu opens, matching its
new position at the top. The listener runs after Just the Docs' own
(head_custom.html loads after just-the-docs.js), so nav-open has
already been toggled by the time it checks. Confirmed this doesn't
prematurely expand the search results UI (that's gated on non-empty
input, unaffected by focus alone) and doesn't affect desktop, where
the menu button is hidden.
Verified via headless Chromium: menu open -> focus lands on
#search-input; typing still triggers results normally; desktop
unaffected.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d0e8fe4 commit e1352de
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
56 | 88 | | |
57 | 89 | | |
58 | 90 | | |
| |||
0 commit comments