Skip to content

fix(styles): make the phone menu opaque and fit the navbar at every width - #223

Merged
fas89 merged 2 commits into
mainfrom
fix/phone-menu-and-navbar
Nov 15, 2026
Merged

fas89 merged 2 commits into
mainfrom
fix/phone-menu-and-navbar

Conversation

@fas89

@fas89 fas89 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

What was wrong

  • The phone menu was see-through. .vp-sidebar { background: transparent } let the page show through the open drawer, so the menu text overlapped the page and could not be read.
  • The navbar was cut off from 720px to about 1395px wide. Its ten links, the search label and the key hints need about 1400px, so on landscape phones, tablets, and 1280px and 1366px laptops they pushed the search button and the color-mode toggle off screen.

What changed (styles only)

  • palette.scss: $MQMobile: 1279px. The default theme reads its mobile breakpoint from this file, in both its CSS and its JS, so below 1280px the navbar links move into the menu drawer.
  • index.scss:
    • The drawer gets the page background, in dark and light mode.
    • From 1280px to 1439px the search button shows as an icon, as slimsearch already does below 960px, and the gap between links drops from 1.5rem to 1rem. At 1440px and wider nothing changes.
    • The closed drawer is visibility: hidden, so its ~300 links leave the tab order until it opens. Before, they took keyboard focus off screen.
    • The site name is inline-block, so the home link is as wide as the name instead of the whole bar.

Trade-off

Below 1280px the page-tree sidebar is in the menu drawer too. Tablets and small laptop windows get full-width content and open the sidebar from the menu button, as phones already did. Keeping a persistent sidebar at those widths would need fewer top-level navbar items. The breakpoints are measured, and palette.scss says to re-measure when a top-level item is added.

Prior art

Validation

  • npm run docs:build passes. Its only warnings are the two existing Vite ones.
  • Headless Chrome against the built site:
    • Navbar at 17 widths from 360px to 1920px: nothing off screen. Menu button up to 1279px, compact bar from 1280px to 1439px, full bar from 1440px.
    • Drawer at 393, 768, 1024 and 1279px: opens on top of code blocks, solid in dark and light, all ten links. When closed, 25 Tab presses never land in it.
    • All 239 pages at 375, 1024 and 1280px: no page scrolls sideways.
    • Five journeys (phone menu to a page, landscape menu and search, tablet menu and theme toggle, laptop search and dropdown, desktop) pass with no console errors.
  • ripwire --quality-delta: no regressions.

Reviews

  • Security review, run on both commits: no high or medium findings.
  • Inspection of the diff: one concern, the sidebar trade-off above, now documented. UX scores 9/10 on the changed surface.
  • Defect scan of the diff: two medium defects, the closed drawer in the tab order and the brand link spanning the bar. Both are fixed in the second commit and re-verified. One low is left: at exactly 1279px the theme's JS (<) and CSS (<=) disagree on the breakpoint, as they did at 719px.

Not checked on a real iPhone or iPad; this used Chrome's device emulation only.

…idth

The menu drawer was see-through on phones. `.vp-sidebar` is transparent
so it blends with the page on desktop, but at the mobile breakpoint and
below it is the drawer laid over the page, and the page text showed
through the menu. It now has the page background there, in dark and
light mode.

The navbar's ten links, search label and key hints need about 1400px.
From 720px to about 1395px they pushed the search button and the
color-mode toggle off screen: on landscape phones, on tablets, and on
laptops at 1280px and 1366px. `$MQMobile` is now 1279px in palette.scss,
so below 1280px the links move into the menu drawer. From 1280px to
1439px the search button shows as an icon, as the slimsearch plugin
already does below 960px, and the gap between links drops from 1.5rem
to 1rem. At 1440px and wider the navbar is unchanged.

Below 1280px the sidebar is the menu drawer as well, so tablets and small
laptop windows get full-width content and open the page tree from the
menu button, as phones already did. The alternative, keeping the
sidebar there, needs fewer top-level navbar items.

The default theme reads $MQMobile from the palette file for both its CSS
and its JS, as its styles docs describe. The same pattern fixed the
sibling FLUID site in open-data-protocol/fluid#54.
Two defects that the wider drawer range exposed. Both were already
present on phones.

The theme slides the closed drawer off screen but leaves it visible, so
its ~300 links stayed in the tab order and keyboard focus vanished off
screen. The drawer is now `visibility: hidden` until it opens, with a
0.3s delay on close so it stays visible while it slides away.

The theme makes the site name a block as wide as the bar's free space,
so a long name can end in an ellipsis. Inside the inline brand link that
stretched the link across the bar, and a click on empty bar space went
home. The name is now inline-block with the same width cap, so the link
is only as wide as the name.

The compact-navbar query now uses range syntax, `width > 1279px`, so a
fractional width between 1279px and 1280px also gets the compact bar.
@fas89
fas89 merged commit 075a6bc into main Nov 15, 2026
9 checks passed

This branch was previously deployed

1 inactive deployment
github-pages — c6f64d6e Deployed Nov 15, 2026 by fas89 via deploy #331
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