From 1d7f770ea92a1fa27eb4549243868bc8a0d3c228 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 14:32:38 +0000 Subject: [PATCH] fix(sidebar): prevent parent nav item from highlighting when child route is active The isActive logic used startsWith to match routes, causing parent items like 'Cloud Agent' (/cloud) to appear selected when visiting child routes like 'Sessions' (/cloud/sessions). Now a parent item is not marked active if a more specific sibling item matches the current pathname. --- src/app/(app)/components/SidebarMenuList.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/(app)/components/SidebarMenuList.tsx b/src/app/(app)/components/SidebarMenuList.tsx index 9ee16d3c8..ca41f3b04 100644 --- a/src/app/(app)/components/SidebarMenuList.tsx +++ b/src/app/(app)/components/SidebarMenuList.tsx @@ -32,7 +32,15 @@ export default function SidebarMenuList({ items, label = 'Dashboard' }: SidebarM {items.map(item => { - const isActive = pathname === item.url || pathname.startsWith(item.url + '/'); + const isActive = + pathname === item.url || + (pathname.startsWith(item.url + '/') && + !items.some( + other => + other.url !== item.url && + other.url.startsWith(item.url + '/') && + (pathname === other.url || pathname.startsWith(other.url + '/')), + )); return (