Skip to content

fix(sidebar): prevent parent nav item from highlighting when child route is active#943

Open
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
fix/sidebar-active-state-prefix-collision
Open

fix(sidebar): prevent parent nav item from highlighting when child route is active#943
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
fix/sidebar-active-state-prefix-collision

Conversation

@kilo-code-bot
Copy link
Contributor

@kilo-code-bot kilo-code-bot bot commented Mar 9, 2026

Summary

  • Fixed a bug where navigating to the Sessions tab (/cloud/sessions) also highlighted the Cloud Agent tab (/cloud) in the sidebar
  • Root cause: the isActive check in SidebarMenuList.tsx used pathname.startsWith(item.url + '/'), which caused parent route items to match when a more specific child route was active
  • The fix adds a check that skips the startsWith match when a sibling nav item has a more specific URL that also matches the current pathname (longest prefix wins)

Verification

  • pnpm typecheck — passes

Visual Changes

N/A

Reviewer Notes

cc @markijbema

The same prefix-collision issue also affected the Webhooks tab (/cloud/webhooks). This fix handles all such cases generically — any nav item whose URL is a prefix of another sibling item will defer to the more specific match.

…ute 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.
@kilo-code-bot kilo-code-bot bot requested a review from markijbema March 9, 2026 14:32
@kilo-code-bot
Copy link
Contributor Author

kilo-code-bot bot commented Mar 9, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/app/(app)/components/SidebarMenuList.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants