Skip to content

fix(nav): the current-page highlight was wired end to end, then dropped - #236

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/nav-contract
Aug 31, 2026
Merged

fix(nav): the current-page highlight was wired end to end, then dropped#236
github-actions[bot] merged 1 commit into
mainfrom
fix/nav-contract

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

GlobalNavigation computes currentView from the path with mapPathToView() and passes it into TopNavigation as a prop — but TopNavigation declared the prop and never read it anywhere in its render. The "highlight the page you're on" feature existed on both ends and did nothing in between: neither a sighted user nor a screen reader could tell which top-level page was current.

That's also why the nav-contract audit flagged this file — the string currentView is present, computing an active state is the declared intent, and zero aria-current existed in the repo.

The fix

usePathname() directly in TopNavigation, rather than finally consuming currentView. That mapping is coarser than the nav items it would need to match against — ROUTES.forms maps to the view key 'saved-forms', Blog isn't mapped at all and silently falls through to 'builder' — so comparing against the live path is more correct, not just more available.

Only the mobile menu's navigation.map() render was touched — it's the only place that array renders; the desktop nav renders its top links as separate inline JSX, a different (already-fixed-elsewhere) concern.

Scope note, stated plainly

This changes what a user sees, not just what assistive tech hears — the active mobile nav item is now visibly highlighted, because a broken feature was actually restored rather than an attribute bolted onto nothing that computes anything. currentView is left unused where it already was; retiring the dead mapPathToView plumbing is a separate cleanup, not folded in here.

Verification

Typecheck: 0 errors (once contentlayer types are generated, per this repo's own CLAUDE.md — pre-existing prerequisite, unrelated to this change). Lint: 0 errors, 2 pre-existing warnings, identical count before/after this diff. 46 tests pass.

Found by the fleet nav-contract audit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE

GlobalNavigation computes `currentView` from the path with mapPathToView()
and passes it into TopNavigation as a prop — but TopNavigation declared the
prop and never read it anywhere in its render. The "highlight the page
you're on" feature existed on both ends and did nothing in between: neither
a sighted user nor a screen reader could tell which top-level page was
current. That is also why the nav-contract audit's grep flagged this file —
the string `currentView` is present, computing an active state is the
declared intent, and zero aria-current existed in the repo.

Fixed with `usePathname()` directly in TopNavigation rather than finally
consuming `currentView`: that mapping is coarser than the nav items it would
need to match against (`ROUTES.forms` maps to the view key `'saved-forms'`,
`Blog` isn't mapped at all and silently falls through to `'builder'`), so
comparing against the live path is more correct, not just more available.

Only the mobile menu's `navigation.map()` render was touched — it's the only
place that array is rendered; the desktop nav renders its top links as
separate inline JSX, a different item the fleet audit did not flag here.

This does change what a user sees, not just what assistive tech hears: the
active mobile nav item is now visibly highlighted, because a broken feature
was actually restored rather than an attribute bolted onto nothing. The
`currentView` prop is left unused where it already was — retiring the dead
mapPathToView plumbing is a separate cleanup, not folded in here.

Typecheck 0 errors (once contentlayer types are generated, per this repo's
own CLAUDE.md — pre-existing prerequisite, unrelated to this change). Lint 0
errors, 2 pre-existing warnings (identical before/after). 46 tests pass.

Found by the fleet nav-contract audit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE
@github-actions
github-actions Bot merged commit d3d8291 into main Aug 31, 2026
1 check passed
@github-actions
github-actions Bot deleted the fix/nav-contract branch August 31, 2026 12:37
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