Skip to content

Commit

Permalink
fix: Prevent the first navbar element from being set as active unnece…
Browse files Browse the repository at this point in the history
…ssarily in the modern template (#10204)

* fix: Prevent the first navbar element from being set as active unnecessarily in the modern template

* style: apply lint rules
  • Loading branch information
KubaZ2 authored Sep 14, 2024
1 parent 99acb5d commit 650ff51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion templates/modern/src/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ function findActiveItem(items: (NavItem | NavItemContainer)[]): NavItem {
continue
}
const prefix = commonUrlPrefix(url, item.href)
if (prefix > maxPrefix) {
if (prefix === maxPrefix) {
activeItem = undefined
} else if (prefix > maxPrefix) {
maxPrefix = prefix
activeItem = item
}
Expand Down

0 comments on commit 650ff51

Please sign in to comment.