diff --git a/libs/ui/src/lib/layout/AppSidebar.tsx b/libs/ui/src/lib/layout/AppSidebar.tsx index c1f252ae2..c7f094697 100644 --- a/libs/ui/src/lib/layout/AppSidebar.tsx +++ b/libs/ui/src/lib/layout/AppSidebar.tsx @@ -46,9 +46,14 @@ export function AppSidebar({ }: AppSidebarProps) { const { t } = useTranslation(); + // Prefer an exact `to` match so sibling routes sharing a path prefix + // (e.g. /vessel-registration and /vessel-registration/transfer) don't + // both light up. Prefix matching is the fallback, for sub-pages that + // aren't themselves in the nav (e.g. /vessel-registration/apply). + const exactMatch = navItems.find((i) => i.to === activePath); const activeNavItem = (item: NavItem) => !!item.to && - (activePath === item.to || activePath.startsWith(`${item.to}/`)); + (exactMatch ? item === exactMatch : activePath.startsWith(`${item.to}/`)); return ( <>