From bd8e9016856265885ed0f81c10ae421d5235cb97 Mon Sep 17 00:00:00 2001 From: Marcel Raddatz Date: Thu, 2 Apr 2026 14:00:18 +0200 Subject: [PATCH] fix(nav): use segment-boundary route matching to prevent false positives Extracts isActiveRoute() into shared nav module. Matches exact path or path + '/' prefix, preventing /settings from matching /settings-advanced. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/nav/DesktopSidebar.svelte | 4 ++-- frontend/src/lib/nav/MobileTabBar.svelte | 4 ++-- frontend/src/lib/nav/TabletNavBar.svelte | 4 ++-- frontend/src/lib/nav/nav.test.ts | 20 +++++++++++++++++++- frontend/src/lib/nav/nav.ts | 4 ++++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/nav/DesktopSidebar.svelte b/frontend/src/lib/nav/DesktopSidebar.svelte index 3812cb5..ec7aa95 100644 --- a/frontend/src/lib/nav/DesktopSidebar.svelte +++ b/frontend/src/lib/nav/DesktopSidebar.svelte @@ -1,6 +1,6 @@ @@ -24,7 +24,7 @@ {section.title}

{#each section.items as item (item.href)} - {@const active = $page.url.pathname.startsWith(item.href)} + {@const active = isActiveRoute(item.href, $page.url.pathname)} import { page } from '$app/stores'; - import { mobileNavItems } from './nav'; + import { mobileNavItems, isActiveRoute } from './nav';