Skip to content

Conversation

MeAkib
Copy link
Contributor

@MeAkib MeAkib commented Aug 30, 2025

Fixed: #63493

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number:
#63493

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

…ted routes

Fix route detection logic to only mark root route (/) as active when URL is exactly "/"
@pullapprove pullapprove bot requested a review from dgp1130 August 30, 2025 07:30
@ngbot ngbot bot added this to the Backlog milestone Aug 30, 2025
@@ -65,7 +65,8 @@ function assignChildrenToParent(
const isLazy = Boolean(child.loadChildren || child.loadComponent);

const pathWithoutParams = routePath.split('/:')[0];
const isActive = currentUrl?.startsWith(pathWithoutParams);
const isActive =
routePath === '/' ? currentUrl === '/' : currentUrl?.startsWith(pathWithoutParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this problem is unique to /, couldn't the same thing happen if you have a route with /foo and another route at /foo/bar? In that scenario, I think visiting /foo/bar would highlight both /foo and /foo/bar.

I wonder if we should try to do a more complete match here? Not sure how complicated that would be. @AleksanderBodurri, what do you think?

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

Successfully merging this pull request may close these issues.

Home Route is always shown as active in Angular DevTools
2 participants