docs: refine mobile header focus behavior
This commit is contained in:
1 file changed
+24
-10
@@ -34,8 +34,9 @@ row and returns focus to the search button.
|
|||||||
The theme button opens an anchored popover below the bar. The popover contains
|
The theme button opens an anchored popover below the bar. The popover contains
|
||||||
Light, Dark, and System as one radio group. It keeps the existing preference
|
Light, Dark, and System as one radio group. It keeps the existing preference
|
||||||
order: an explicit user choice wins; System follows the operating-system
|
order: an explicit user choice wins; System follows the operating-system
|
||||||
preference. Escape or a click outside closes the popover and returns focus to
|
preference. Escape or the theme button closes the popover and restores focus to
|
||||||
the theme button.
|
the theme button. A pointer or focus move outside closes the popover without
|
||||||
|
overriding the user's new focus.
|
||||||
|
|
||||||
### Menu
|
### Menu
|
||||||
|
|
||||||
@@ -43,9 +44,15 @@ The menu button opens the primary navigation below the bar. The existing links
|
|||||||
and URLs stay unchanged. Escape closes the menu and returns focus to the menu
|
and URLs stay unchanged. Escape closes the menu and returns focus to the menu
|
||||||
button.
|
button.
|
||||||
|
|
||||||
Opening Search, Theme, or Menu closes either of the other two panels. Resizing
|
Opening Search, Theme, or Menu closes either of the other two panels. The newly
|
||||||
to desktop closes mobile panels and prevents focus from remaining in hidden
|
activated control owns focus; closing another panel does not restore its old
|
||||||
content. The header does not trap Tab focus.
|
focus. Search moves focus to its input. Theme and Menu keep focus on their
|
||||||
|
buttons, so the next Tab enters the checked radio or first navigation link.
|
||||||
|
|
||||||
|
Resizing to desktop closes mobile-only panel state. If that closure would hide
|
||||||
|
the focused element, focus moves to its visible trigger. If the Menu trigger
|
||||||
|
itself becomes hidden, focus moves to the first primary-navigation link. Focus
|
||||||
|
otherwise stays unchanged. The header does not trap Tab focus.
|
||||||
|
|
||||||
## Progressive enhancement
|
## Progressive enhancement
|
||||||
|
|
||||||
@@ -60,7 +67,8 @@ additional rows, but it must remain readable and operable.
|
|||||||
- Toggle buttons expose `aria-expanded` and `aria-controls`.
|
- Toggle buttons expose `aria-expanded` and `aria-controls`.
|
||||||
- The theme choices keep native radio semantics and a fieldset legend.
|
- The theme choices keep native radio semantics and a fieldset legend.
|
||||||
- Popover and panel state never hide the active element.
|
- Popover and panel state never hide the active element.
|
||||||
- Escape and resize restore or move focus predictably.
|
- Escape restores trigger focus; outside clicks preserve the new target.
|
||||||
|
- Resize uses the explicit focus destinations defined above.
|
||||||
- Keyboard order is Search, Theme, Menu, followed by the opened panel.
|
- Keyboard order is Search, Theme, Menu, followed by the opened panel.
|
||||||
- Focus indicators meet the existing CHRNX contrast and visibility rules.
|
- Focus indicators meet the existing CHRNX contrast and visibility rules.
|
||||||
- Reduced-motion mode removes nonessential transitions.
|
- Reduced-motion mode removes nonessential transitions.
|
||||||
@@ -68,21 +76,27 @@ additional rows, but it must remain readable and operable.
|
|||||||
## Responsive scope
|
## Responsive scope
|
||||||
|
|
||||||
The compact bar applies at the existing mobile breakpoint, up to 599 px. Tablet
|
The compact bar applies at the existing mobile breakpoint, up to 599 px. Tablet
|
||||||
and desktop behavior remain unchanged unless testing exposes a breakpoint
|
and desktop behavior remain unchanged. Any breakpoint collision must be solved
|
||||||
collision.
|
inside the mobile scope or returned for approval.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Write failing tests before production changes. Cover:
|
Write failing tests before production changes. Cover:
|
||||||
|
|
||||||
- one-row layout at 375 px;
|
- one-row layout at the narrowest supported width, 375 px, and 599 px;
|
||||||
|
- no overlap or overflow at 375 px and the 599/600 px boundary;
|
||||||
|
- unchanged non-mobile layout at 600 px and representative desktop widths;
|
||||||
- mutual exclusion of Search, Theme, and Menu;
|
- mutual exclusion of Search, Theme, and Menu;
|
||||||
- Escape, outside click, and focus restoration;
|
- Escape, outside click, and focus restoration;
|
||||||
- Tab order without a focus trap;
|
- Tab order without a focus trap;
|
||||||
- mobile-to-desktop and desktop-to-mobile resize behavior;
|
- mobile-to-desktop and desktop-to-mobile resize behavior;
|
||||||
- no-JavaScript navigation and search;
|
- no-JavaScript navigation and search;
|
||||||
- Light, Dark, and System persistence;
|
- stored Light or Dark overriding the operating-system preference and later
|
||||||
|
operating-system changes;
|
||||||
|
- System following operating-system changes;
|
||||||
|
- theme preference surviving reloads;
|
||||||
- 44–45 px targets, accessible names, and automated WCAG checks;
|
- 44–45 px targets, accessible names, and automated WCAG checks;
|
||||||
|
- no-JavaScript system styling, visible navigation, and GET search submission;
|
||||||
- Chromium, Firefox, and WebKit;
|
- Chromium, Firefox, and WebKit;
|
||||||
- refreshed dark/light mobile screenshots for visual approval.
|
- refreshed dark/light mobile screenshots for visual approval.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user