Skip to content

fix: fix incorrect nav animations #28297

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
fix: apply root transition when using root routerLink and browser bac…
…k button
  • Loading branch information
philipp-stsm committed Oct 31, 2023
commit 2c3a5299158a6c9c3a5d8bea8be943034a90b28e
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,29 @@ export class StackController {
*
* This can happen e.g. when navigating to a page with navigateRoot and then using the browser back button
*/
if (
const isPopStateTransitionFromRootPage =
direction === 'back' &&
isDirectionBasedOnNavigationIds &&
leavingView?.root &&
currentNavigation?.trigger === 'popstate'
) {
if (leavingViewIndex >= 0) {
this.views.splice(leavingViewIndex, 1);
}
}
currentNavigation?.trigger === 'popstate';

/**
* direction based on stack order takes precedence over direction based on navigation ids
* whether direction based on stack order takes precedence over direction based on navigation ids
*
* only applied if the user did not explicitly set the direction
* (e.g. via the NavController, routerLink directive etc.)
*/
if (isDirectionBasedOnNavigationIds && suggestedDirectionBasedOnStackOrder) {
const shouldSuggestedDirectionBasedOnStackOrderTakePrecedence =
isDirectionBasedOnNavigationIds && suggestedDirectionBasedOnStackOrder;

if (isPopStateTransitionFromRootPage) {
direction = 'root';
animation = undefined;

if (leavingViewIndex >= 0) {
this.views.splice(leavingViewIndex, 1);
}
} else if (shouldSuggestedDirectionBasedOnStackOrderTakePrecedence) {
direction = suggestedDirectionBasedOnStackOrder;
animation = suggestedDirectionBasedOnStackOrder;
}
Expand Down