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 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { desktopNavSections } from './nav';
|
||||
import { desktopNavSections, isActiveRoute } from './nav';
|
||||
|
||||
let { appName, householdName }: { appName: string; householdName: string } = $props();
|
||||
</script>
|
||||
@@ -24,7 +24,7 @@
|
||||
{section.title}
|
||||
</p>
|
||||
{#each section.items as item (item.href)}
|
||||
{@const active = $page.url.pathname.startsWith(item.href)}
|
||||
{@const active = isActiveRoute(item.href, $page.url.pathname)}
|
||||
<a
|
||||
href={item.href}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
|
||||
Reference in New Issue
Block a user