Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix incorrect nav animations #28297

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hoi4
Copy link
Contributor

@hoi4 hoi4 commented Oct 6, 2023

This PR is a follow-up to #28188.

Respective issue: #28307

It fixes an issue where the nav animation is sometimes incorrect when using the browser back and forward buttons to navigate through multiple pages.
The last nav animation in the following video should be forward, but is back instead.

Screen.Recording.2023-10-06.at.08.29.22.mov

Angular's navigation ids are not a reliable solution because Angular does not reuse navigations.
From the docs:

From the perspective of the router, the router never "goes back". When the user clicks on the back button in the browser, a new navigation ID is created.

Solution

Ionic already manages a navigation stack internally. Instead of "guessing" the nav animation direction based on Angular's router navigation ids, we can use the navigation stack to derive the required nav animation.

Recording with my changes:

Screen.Recording.2023-10-06.at.08.41.26.mov

Does this introduce a breaking change?

  • Yes
  • No

@github-actions github-actions bot added the package: angular @ionic/angular package label Oct 6, 2023
@hoi4
Copy link
Contributor Author

hoi4 commented Oct 6, 2023

FYI, @liamdebeasi :)

@liamdebeasi
Copy link
Contributor

Hey @hoi4,

Thanks for making a separate PR! Does this PR already have an associated issue? If so, can you please link it in the PR template? If not, could you please make one and include a reproduction?

@hoi4
Copy link
Contributor Author

hoi4 commented Oct 9, 2023

@liamdebeasi issue created and linked ✅

@hoi4 hoi4 force-pushed the fix-incorrect-nav-animations branch from 9363056 to c8370d9 Compare October 31, 2023 13:22
@sean-perkins sean-perkins removed their request for review May 22, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants