Skip to content

fix(router): Ensure anchor scrolling happens on ignored same URL navigations#48025

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

fix(router): Ensure anchor scrolling happens on ignored same URL navigations#48025
atscott wants to merge 1 commit intoangular:mainfrom
atscott:navigationCancelOnIgnore

Conversation

@atscott
Copy link
Copy Markdown
Contributor

@atscott atscott commented Nov 11, 2022

The Router scroller only listens for NavigationEnd events. However, the
default behavior of the Router is to ignore navigations to the same URL.
This breaks the anchor scrolling when clicking on an anchor whose
fragment is already in the URL.

fixes #29099

BREAKING CHANGE: The Scroll event's routerEvent property may also be
a NavigationSkipped event. Previously, it was only a NavigationEnd
event.

@atscott atscott added the target: major This PR is targeted for the next major release label Nov 11, 2022
@angular-robot angular-robot bot added detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit labels Nov 11, 2022
@atscott atscott force-pushed the navigationCancelOnIgnore branch from 2da5f46 to 682707a Compare November 11, 2022 00:12
@ngbot ngbot bot added this to the Backlog milestone Nov 11, 2022
@pkozlowski-opensource pkozlowski-opensource added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 11, 2022
@atscott atscott removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 12, 2022
@atscott atscott force-pushed the navigationCancelOnIgnore branch from 682707a to 7db94b7 Compare November 12, 2022 00:18
@pkozlowski-opensource pkozlowski-opensource added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 14, 2022
@pkozlowski-opensource
Copy link
Copy Markdown
Member

cleanup: CI is failing, looks like the PR still needs golden file update.

@atscott atscott removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 14, 2022
@atscott atscott force-pushed the navigationCancelOnIgnore branch from 7db94b7 to adde971 Compare November 14, 2022 16:05
Copy link
Copy Markdown
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

reviewed-for: public-api

@pullapprove pullapprove bot requested a review from dylhunn November 14, 2022 18:10
@atscott atscott modified the milestones: Backlog, v16-candidates Nov 14, 2022
Copy link
Copy Markdown
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: public-api

@atscott atscott force-pushed the navigationCancelOnIgnore branch from adde971 to 8207176 Compare November 23, 2022 21:18
@angular-robot angular-robot bot removed the detected: feature PR contains a feature commit label Nov 23, 2022
@atscott atscott force-pushed the navigationCancelOnIgnore branch from 8207176 to 42d0402 Compare November 23, 2022 21:19
@atscott atscott force-pushed the navigationCancelOnIgnore branch from 42d0402 to b8b58a5 Compare December 13, 2022 23:25
…gations

The Router scroller only listens for NavigationEnd events. However, the
default behavior of the Router is to ignore navigations to the same URL.
This breaks the anchor scrolling when clicking on an anchor whose
fragment is already in the URL.

fixes angular#29099

BREAKING CHANGE: The `Scroll` event's `routerEvent` property may also be
a `NavigationSkipped` event. Previously, it was only a `NavigationEnd`
event.
@atscott atscott force-pushed the navigationCancelOnIgnore branch from b8b58a5 to 89b9772 Compare December 13, 2022 23:48
@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Feb 17, 2023
@atscott atscott removed request for alxhub and dylhunn February 17, 2023 18:23
@AndrewKushnir
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 1f055b9.

@angular-automatic-lock-bot
Copy link
Copy Markdown

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 Mar 20, 2023
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 detected: breaking change PR contains a commit with a breaking change target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anchor scrolling only works first time it is clicked and not on subsequent clicks.

4 participants