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

3.3 KiB
Raw Blame History

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

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 a click outside closes the popover and returns focus to the theme button.

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. Resizing to desktop closes mobile panels and prevents focus from remaining in hidden content. 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 and resize restore or move focus predictably.
  • 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 unless testing exposes a breakpoint collision.

Testing

Write failing tests before production changes. Cover:

  • one-row layout at 375 px;
  • 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;
  • Light, Dark, and System persistence;
  • 44–45 px targets, accessible names, and automated WCAG checks;
  • 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