Skip to content

fix(sidebar): move the rail collapse toggle into the header row - #804

Draft
smmariquit wants to merge 1 commit into
stagingfrom
fix/sidebar-rail-toggle-placement
Draft

fix(sidebar): move the rail collapse toggle into the header row#804
smmariquit wants to merge 1 commit into
stagingfrom
fix/sidebar-rail-toggle-placement

Conversation

@smmariquit

Copy link
Copy Markdown
Collaborator

Problem

The rail retract/expand arrow sat as a NavLink in the .top flow, between the logo button and the .categories group.

  • Expanded desktop rail: it rendered a full-width labelled row, "Collapse menu", directly above Maps — identical typography, hover, and hit area to Buildings / Dorms / Planner. A control that acts on the rail looked like the first destination in the nav.
  • Mobile drawer: same row, reading "Close menu", again above Maps.
  • Collapsed rail: an unlabelled chevron floating in dead space with a 1.25rem gap on both sides, visually part of neither the logo nor the nav.

Change

Logo button + toggle now live in one .sidebar-header row.

  • Expanded rail (13rem) and mobile drawer (13rem): row layout, wordmark left, toggle right-aligned (margin-left: auto), icon-only. Reclaims a full row; Maps is the first list item again.
  • Collapsed rail (4rem): 48px of content width cannot fit a second item on the logo row, so the toggle stays stacked under the logo — but at a 0.25rem gap it now groups with the logo instead of floating between logo and nav.

handleRailToggle and its isMobileRail branch are untouched; only placement and label mode changed. The NavLink is now expanded={false} in every state, so it never renders an inline label and never switches tooltip modes (the class of bug behind #755/#757).

Verification

Built with build:e2e, served dist/server/entry.mjs with real DATABASE_URL + PUBLIC_MAPTILER_KEY, driven headless.

State Accessible name Hit target Header overflow Rail overflow Doc overflow
Desktop collapsed (4rem) Expand menu 44x44 0 0 -
Desktop expanded (13rem) Collapse menu 44x44 0 0 -
Mobile drawer @320 Close menu 52x44 0 0 0
Mobile drawer @768 Close menu 52x44 0 0 0
  • Collapsed rail tooltip: opacity 0 at rest, 1 on hover, correct text, anchored at x=62 beside the 64px rail. Toggling expanded -> collapsed with the pointer away leaves it at opacity 0 (no [BUG] Sidebar titles flash for a split second when collapsing menu #755-style flash).
  • Tab from "Room TBA home" lands on the toggle, before the nav list.
  • Mobile drawer closes at 320 and 768 (aside.retracted reapplied).
  • e2e/browse/search-collapse.spec.ts resolves the control by getByRole("button", { name: "Close menu" }); the aria-label is unchanged.

bunx vitest run 161 pass, bun run test 438 pass, bunx biome check clean on touched files, bun run build green. Added a component test pinning the toggle to .sidebar-header, out of .categories, and never nav-link--expanded.

Left alone

Draft, and deliberately no run/e2e label — a serial CI queue is running and concurrent E2E runs exhaust the shared pooler.

The toggle was a NavLink in the `.top` flow between the logo and the
destination list, so with the rail expanded it rendered a full-width
labelled row reading "Collapse menu" directly above Maps — a control
styled and positioned as the first place you can go. Same on the mobile
drawer, where it read "Close menu".

It now sits in a `.sidebar-header` row beside the wordmark, right-aligned
and icon-only, on the expanded rail and the mobile drawer; the 4rem
collapsed rail has no room for a second item on that row, so it stays
stacked under the logo but grouped with it instead of floating between
the logo and the nav.

Behaviour is unchanged (handleRailToggle still branches on isMobileRail).
aria-label still names the state ("Expand menu" / "Collapse menu" /
"Close menu"), tab order still puts it right after the home button, and
the hit target is >= 44px in every state.
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
saan-ang-room Ready Ready Preview, Comment Jul 26, 2026 7:03pm

Request Review

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