Skip to content

Commit 8a94c5e

Browse files
authored
Merge pull request #183 from DHBern/182-wrong-highlighting-of-current-route
fix: active route highlighting compares more granular
2 parents 2b3d261 + 371665a commit 8a94c5e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/routes/+layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
let { children } = $props();
1212
1313
let classesActive = $derived((/** @type {string} */ href) =>
14-
base + href === `/${page.url.pathname.split('/')[1]}`
15-
? 'bg-primary-300 hover:bg-primary-300 hover:text-primary-700 text-primary-900'
14+
href.split('/')[1] === page.url.pathname.split('/')[1] || href.split('/')[1] === page.url.hash
15+
? 'bg-primary-300 hover:bg-primary-300 hover:text-primary-700 text-primary-900'
1616
: 'hover:text-primary-600'
1717
);
1818

0 commit comments

Comments
 (0)