From 85ca7c1123741d406eefd8b0bbfe9b93f36258d9 Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Mon, 31 Aug 2026 13:33:41 +0200 Subject: [PATCH] fix(nav): both sidebars styled the current page and never announced it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The admin sidebar compared `pathname.startsWith(href)` and the portal sidebar had its own `isActive(href)` helper — both used the result to paint a highlight and set no aria-current, so the current page existed only for people who can see it. Zero occurrences of aria-current in the whole repo. Also brings both to the 44px touch floor (py-2 on text-sm was ~36px), which this repo enforced nowhere either. No visual change: the active styling classes are untouched. Found by the fleet nav-contract audit, which flags a repo whose navigation computes an active state and never announces it anywhere. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE --- components/admin/sidebar.tsx | 7 ++++++- components/portal/sidebar-nav.tsx | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/components/admin/sidebar.tsx b/components/admin/sidebar.tsx index c316bd6..7821709 100644 --- a/components/admin/sidebar.tsx +++ b/components/admin/sidebar.tsx @@ -79,8 +79,13 @@ export function AdminSidebar({ key={href} href={href} onClick={() => setOpen(false)} + // The comparison below already knows which item is the page you are + // on; it only painted it. Announce it too. + aria-current={pathname.startsWith(href) ? "page" : undefined} className={cn( - "flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors", + // min-h-11 is the 44px touch floor. py-2 on text-sm came out near + // 36px on the sidebar this app is driven from. + "flex min-h-11 items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors", pathname.startsWith(href) ? "bg-teal-600 text-white" : "text-slate-400 hover:bg-slate-800 hover:text-white", diff --git a/components/portal/sidebar-nav.tsx b/components/portal/sidebar-nav.tsx index d466e47..4ff183e 100644 --- a/components/portal/sidebar-nav.tsx +++ b/components/portal/sidebar-nav.tsx @@ -63,8 +63,9 @@ export function PortalSidebarNav({ onClose, unreadThreads = 0 }: Props) { key={href} href={href} onClick={onClose} + aria-current={isActive(href) ? "page" : undefined} className={cn( - "flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors", + "flex min-h-11 items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors", isActive(href) ? "bg-teal-50 text-teal-700" : "text-slate-600 hover:bg-slate-50 hover:text-slate-900", @@ -81,8 +82,9 @@ export function PortalSidebarNav({ onClose, unreadThreads = 0 }: Props) {