From 650ff51dea1ff10554449f833ba6f3f9b821025b Mon Sep 17 00:00:00 2001 From: Kuba_Z2 <77853483+KubaZ2@users.noreply.github.com> Date: Sat, 14 Sep 2024 14:33:51 +0200 Subject: [PATCH] fix: Prevent the first navbar element from being set as active unnecessarily 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 --- templates/modern/src/nav.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/modern/src/nav.ts b/templates/modern/src/nav.ts index 9660b0a5534..7ff75dcce26 100644 --- a/templates/modern/src/nav.ts +++ b/templates/modern/src/nav.ts @@ -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 }