fix(nav): the admin sidebar styled the current page without announcing it - #415
Merged
Conversation
…g it
All three of AdminSidebar's link sites passed an `active` flag into
`navLinkClass('sidebar', active)` and none set aria-current, so the highlight
existed only for people who can see it. Every other nav surface in this app —
NavItem, BottomNav, MobileMenuNav, Breadcrumbs, DashboardMobileNav — already
announced it correctly.
Fixed at the SSOT rather than at the three call sites. `navLinkClass` returns
a className and nothing else, which is what made "styled but silent" easy to
write: the styling decision and the announcement lived in different places, so
they could drift. `navLinkProps` returns both, and spreading it means they
cannot:
<Link href={x} {...navLinkProps('sidebar', active)} />
Deliberately NOT applied to every navLinkClass caller. The chip, tab and
segmented shapes are buttons and tab controls where `aria-selected` is the
correct attribute, not `aria-current` — a blanket sweep would have been wrong
in more places than it fixed. navLinkClass stays for those.
Five tests on the helper, including one asserting its className is byte-identical
to what navLinkClass returns for every shape and both states, so this cannot
quietly restyle anything.
Found by a fleet-wide navigation audit across 20 repos, which found the same
one-straggler shape in aoz-housing, fleetcrown and vitareba.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All three of
AdminSidebar's link sites passed anactiveflag intonavLinkClass('sidebar', active)and none setaria-current— so the highlight existed only for people who can see it. Every other nav surface here (NavItem,BottomNav,MobileMenuNav,Breadcrumbs,DashboardMobileNav) already announced it correctly.Fixed at the SSOT, not the call sites
navLinkClassreturns a className and nothing else, which is what made "styled but silent" easy to write: the styling decision and the announcement lived in different places, so they could drift.navLinkPropsreturns both, and spreading it means they can't:Deliberately not a blanket sweep
navLinkClasshas other callers —chip,tabandsegmentedshapes inTabs,FilterBar,ApprovalTabsandLocaleSwitcher. Those are buttons and tab controls wherearia-selectedis the correct attribute, notaria-current. Converting them would have been wrong in more places than it fixed, sonavLinkClassstays for those.Tests
Five on the helper, including one asserting its className is byte-identical to what
navLinkClassreturns for every shape and both states — so this cannot quietly restyle anything.Typecheck clean, lint clean, 47 tests pass across the design suites.
Found by a fleet-wide navigation audit across 20 repos, which found the same one-straggler shape in aoz-housing, fleetcrown and vitareba.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE