Skip to content

A phone menu on pages without a sidebar - #104

Merged
b4rb13 merged 1 commit into
mainfrom
site/mobile-nav
Nov 20, 2026
Merged

b4rb13 merged 1 commit into
mainfrom
site/mobile-nav

Conversation

@b4rb13

@b4rb13 b4rb13 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

On phones (50rem and below) the header hides its main links. Docs pages reach them through Starlight's menu button. The splash pages (/, /pricing/, /examples/, /playground/ and the 404) had no way to the main sections. The owner picked option A, a menu button with a panel, over a scrolling row of links.

 <Header> (apps/site/src/components/site/Header.astro)
   brand · nav "Main" (hidden on phones) · search · GitHub · theme (hidden on phones)
+  only when the page has no sidebar:
+  <button popovertarget="site-menu" aria-expanded>   same size, place and fill as Starlight's
+  <div popover id="site-menu">                        a panel under the header, light scrim
+    <nav "Main">  six links, current page marked
+    Theme <ThemeSelect>
  • Without a script: the popover opens, closes on Escape and closes on a tap outside.
  • With the script:
    • keeps aria-expanded in sync;
    • returns focus to the button on Escape;
    • closes the panel when focus tabs past it, when a link is followed (so Back doesn't bring it back open), or when the page widens past 50rem.
  • Motion: 320 ms. Opacity uses the fade curve and a 4 px rise uses the settle curve; reduced motion drops the rise.
  • Forced colours: the button and the panel get borders, and the current link is outlined.
  • No layout shift: the button is rendered on the server, and the panel opens in the top layer over the page.

Evidence

Phone screenshots at 375 px. Before: / and /pricing/. After: / closed and open, then /pricing/ open in dark mode.

Before: the header on / and /pricing/ at 375 px has only the logo, search and GitHub. After: the same header with a round menu button; open, a panel lists Docs, Components, Guides, Examples, Playground and Pricing, then the theme switch; on /pricing/ in dark mode, Pricing is marked as the current page.
  • Before: tests/site/menu.spec.ts against the main build: 9 failed (no menu button on splash pages).
    After: 9 passed. The whole site-chromium project: 91 passed. bun run lint and bun run check pass.
phone 375×812, on / /pricing/ /examples/ /playground/
  Menu visible, aria-expanded=false, nav "Main" hidden
  click → aria-expanded=true; the six links with their hrefs, all fully in view; current page has aria-current
  h1 box unchanged (no shift); tap outside → closed
keyboard on /
  Enter opens, focus stays on the button; Tab → Docs, Tab → Components
  Escape → closed, focus back on the button with a ring; Space then Escape on the button
  Tab past the theme select → closed
link: Pricing → /pricing/; Back → menu closed
theme: choose Dark in the panel → html[data-theme=dark]
docs: /docs/ has one Menu button (Starlight's) and it opens the sidebar; the splash button is within 1 px of it
desktop 1280: no Menu button, six header links; a menu left open on a phone closes when the page widens

/docs/ at 375 px is byte-identical before and after. The desktop header at 1280 px is byte-identical to dotquilt.dev.

Merge Danger

Door: two-way

Blast Radius: header

Phones only, on pages without a sidebar. The existing 320 px fit test covers a crowded header. Popover support (Safari 17+, Firefox 125+) is what Starlight's own sidebar menu already needs. PR #103 doesn't touch Header.astro.

🤖 Generated with Claude Code

On phones the header hides its main links. Docs pages reach them through
Starlight's menu button, but the splash pages (/, /pricing/, /examples/,
/playground/ and the 404) had no way to the main sections at all.

Those pages now get a menu button in the same place and style as
Starlight's. It opens a panel under the header with the six main links and
the theme switch, which phones also lost on these pages. The panel is a
popover, so it opens, closes on Escape and closes on a tap outside even
before scripts run. The script keeps aria-expanded in sync, returns focus
to the button on Escape, and closes the panel when focus moves past it,
when a link is followed or when the page widens. It settles in over the
site's 320 ms UI timing, without movement under reduced motion.

Docs pages and the desktop header are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dotquilt Ready Ready Preview Nov 20, 2026 9:50pm UTC

Request Review

@b4rb13
b4rb13 merged commit 1880771 into main Nov 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant