Files
chrnx-dev-wp/docs/superpowers/specs/2026-08-11-mobile-header-design.md
T

111 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CHRNX Mobile Header Design
Date: 2026-08-11
Status: Approved direction, pending implementation
## Problem
At mobile widths, the current header wraps into three rows. Search becomes a
detached square button, and the permanent Light, Dark, and System controls
dominate the page. The controls remain functional, but the composition looks
unfinished and pushes the content down.
## Approved direction
Use one compact mobile bar. Place the CHRNX mark on the left and three 44–45 px
controls on the right, in this order:
1. Search
2. Theme
3. Menu
Keep the existing desktop header unchanged.
## Interaction
### Search
The search button expands a full-width search row below the main bar and
focuses the input. Submitting uses the existing GET search. Escape closes the
row and returns focus to the search button.
### Theme
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
order: an explicit user choice wins; System follows the operating-system
preference. Escape or the theme button closes the popover and restores focus to
the theme button. A pointer or focus move outside closes the popover without
overriding the user's new focus.
### Menu
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
button.
Opening Search, Theme, or Menu closes either of the other two panels. The newly
activated control owns focus; closing another panel does not restore its old
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
on the mobile Theme trigger moves to the checked desktop theme radio. Focus
otherwise stays unchanged. The header does not trap Tab focus.
## Progressive enhancement
Without JavaScript, the primary navigation and GET search remain available. The
theme follows the system preference because a stored client preference cannot
be applied interactively without JavaScript. The no-JavaScript layout may use
additional rows, but it must remain readable and operable.
## Accessibility
- Every control has an accessible name and a 44–45 px target.
- Toggle buttons expose `aria-expanded` and `aria-controls`.
- The theme choices keep native radio semantics and a fieldset legend.
- Popover and panel state never hide the active element.
- 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.
- Focus indicators meet the existing CHRNX contrast and visibility rules.
- Reduced-motion mode removes nonessential transitions.
## Responsive scope
The compact bar applies at the existing mobile breakpoint, up to 599 px. Tablet
and desktop behavior remain unchanged. Any breakpoint collision must be solved
inside the mobile scope or returned for approval.
## Testing
Write failing tests before production changes. Cover:
- 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;
- Escape, outside click, and focus restoration;
- Tab order without a focus trap;
- mobile-to-desktop and desktop-to-mobile resize behavior;
- no-JavaScript navigation and search;
- 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;
- no-JavaScript system styling, visible navigation, and GET search submission;
- Chromium, Firefox, and WebKit;
- refreshed dark/light mobile screenshots for visual approval.
## Non-goals
- Redesigning the desktop header
- Changing navigation labels or destinations
- Changing the CHRNX mark
- Adding animation beyond a short optional state transition
- Replacing the existing theme-preference storage model