Skip to content

Commit 9883eac

Browse files
liamdebeasihoi4
andauthored
fix(angular): transition plays when using browser buttons (#28530)
Issue number: resolves #16569 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Ionic Angular's routing integration disables page transitions when using the browser back/forward buttons. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Transitions now play when using the back/forward buttons ## Does this introduce a breaking change? - [ ] Yes - [x] No We're not aware of any breaking changes here, though it's possible some developers were relying on this behavior. As a result, we are targeting Ionic 8 to minimize any potential negative impact this fix may have on developers. <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Supersedes #28188 Dev build: `7.5.6-dev.11700068172.15ce9b35` Co-authored-by: hoi4 <[email protected]>
1 parent aa2a7f5 commit 9883eac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/angular/common/src/providers/nav-controller.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export class NavController {
3737
if (router) {
3838
router.events.subscribe((ev) => {
3939
if (ev instanceof NavigationStart) {
40+
// restoredState is set if the browser back/forward button is used
4041
const id = ev.restoredState ? ev.restoredState.navigationId : ev.id;
41-
this.guessDirection = id < this.lastNavId ? 'back' : 'forward';
42-
this.guessAnimation = !ev.restoredState ? this.guessDirection : undefined;
42+
this.guessDirection = this.guessAnimation = id < this.lastNavId ? 'back' : 'forward';
4343
this.lastNavId = this.guessDirection === 'forward' ? ev.id : id;
4444
}
4545
});

0 commit comments

Comments
 (0)