Issue 437
enhancement: Dialog, and the mobile menu as an accessible sheet
Back to our planDone
enhancementfrontenduxpriority: medium
Problem
The mobile menu writes its own dialog behaviour: Escape, a scroll lock, focus return, closing on a route change, and closing past the desktop breakpoint (N10). It opens below the header as an in-page panel, so focus can leave it while it's open and the page behind stays reachable. The design guidelines ask for a full-screen overlay or slide-in drawer.
Goal
Add Dialog (variant: sheet) to src/platform/ui/, as specified in docs/ui/component-set.md. It has open, onOpenChange, title and a trigger. Radix Dialog provides the focus trap, Escape, scroll lock and focus return. The mobile menu becomes a sheet under the header.
Native first
- Native: the HTML
<dialog>element has no scroll lock oraria-hiddenon the rest of the page, and its focus handling differs across browsers. - Official/established: Radix Dialog (
@radix-ui/react-dialog), from the same family as the Radix Select and Checkbox we already use. Version~1.1.15shares their installed internals (dismissable layer 1.1.11, focus scope 1.1.7), so it adds almost nothing to the bundle. MIT, by WorkOS, millions of weekly downloads. - Our code: only the look.
Acceptance criteria
- Not done:
Dialogis built, with tests: role, name, Escape, closing, axe. - Not done: The mobile menu uses it. Focus is trapped, Escape and the close button close it, focus returns to the toggle, the page behind is inert and doesn't scroll, and it closes on navigation and past
lg. - Not done: Tested on a phone-sized viewport, in light and dark.
Generated by Claude Code, opens in a new tab