Skip to content

fix(router): RouterLinkActive will always remove active classes when …#54982

Closed
atscott wants to merge 1 commit intoangular:mainfrom
atscott:alwaysAddOrRemoveClasses
Closed

fix(router): RouterLinkActive will always remove active classes when …#54982
atscott wants to merge 1 commit intoangular:mainfrom
atscott:alwaysAddOrRemoveClasses

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Mar 21, 2024

…links are not active

Previously, RouterLinkActive would only add or remove the active classes when its active state changed. This means that if you accidentally add one of the active classes to the static class attribute, it won't get removed until the link becomes active and then deactives (because the class is added at creation time and never removed until the RouterLinkActive state changes from active to inactive).

fixes #54978

@atscott atscott added area: router target: patch This PR is targeted for the next patch release labels Mar 21, 2024
@ngbot ngbot bot modified the milestone: Backlog Mar 21, 2024
…links are not active

Previously, `RouterLinkActive` would only add or remove the active classes when
its active state changed. This means that if you accidentally add one of
the active classes to the static class attribute, it won't get removed
until the link becomes active and then deactives (because the class is
added at creation time and never removed until the `RouterLinkActive`
state changes from active to inactive).

fixes angular#54978
@atscott atscott force-pushed the alwaysAddOrRemoveClasses branch from b100d1d to 98f7776 Compare March 21, 2024 17:26
Copy link
Contributor

@sonukapoor sonukapoor left a comment

Choose a reason for hiding this comment

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

LGTM

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Mar 26, 2024
@dylhunn
Copy link
Contributor

dylhunn commented Mar 27, 2024

This PR was merged into the repository by commit eae75ff.

@dylhunn dylhunn closed this in eae75ff Mar 27, 2024
dylhunn pushed a commit that referenced this pull request Mar 27, 2024
…links are not active (#54982)

Previously, `RouterLinkActive` would only add or remove the active classes when
its active state changed. This means that if you accidentally add one of
the active classes to the static class attribute, it won't get removed
until the link becomes active and then deactives (because the class is
added at creation time and never removed until the `RouterLinkActive`
state changes from active to inactive).

fixes #54978

PR Close #54982
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: router target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

routerLinkActive doesn´t set the active class correctly

3 participants