Skip to content

feat(router-outlet): add swipeGesture prop to control swipe-to-go-back per outlet#31055

Open
ShaneK wants to merge 3 commits intomajor-9.0from
FW-6964
Open

feat(router-outlet): add swipeGesture prop to control swipe-to-go-back per outlet#31055
ShaneK wants to merge 3 commits intomajor-9.0from
FW-6964

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented Apr 1, 2026

Issue number: resolves internal


What is the current behavior?

The swipe-to-go-back gesture on ion-router-outlet is controlled differently across frameworks:

  • React and Vue check the swipeBackEnabled config option on every swipe attempt in their framework wrappers (StackManager.canStart() and IonRouterOutlet.canStart())
  • Angular reads the config once at mount and controls the gesture through its directive's swipeGesture setter
  • There is no public, per-outlet property to enable or disable the gesture. The only mechanism is the global swipeBackEnabled config option

What is the new behavior?

ion-router-outlet now exposes a public swipeGesture property in core that controls the swipe-to-go-back gesture per outlet instance. It defaults to true in "ios" mode and false in "md" mode, matching existing behavior.

  • The swipeBackEnabled config is read once when the outlet mounts (as the default for swipeGesture) rather than checked on every swipe attempt
  • The config check has been removed from React's StackManager and Vue's IonRouterOutlet -- core now owns this state
  • Angular's directive forwards the value to the core component's swipeGesture property for consistency
  • Apps can disable the gesture on a specific outlet: <IonRouterOutlet swipeGesture={false} />
  • Apps that set swipeBackEnabled once at startup require no changes

Does this introduce a breaking change?

  • Yes
  • No

Other information

I tried to align the updates to the BREAKING.md documents with the RR6 PR's changes to it to prevent issues from merging as much as possible

@ShaneK ShaneK requested a review from a team as a code owner April 1, 2026 16:35
@ShaneK ShaneK requested a review from BenOsodrac April 1, 2026 16:35
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Apr 1, 2026 9:26pm

Request Review

@github-actions github-actions bot added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Apr 1, 2026
Copy link
Copy Markdown

@codeCraft-Ritik codeCraft-Ritik left a comment

Choose a reason for hiding this comment

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

This is a fantastic PR description. You've clearly outlined the discrepancies between the different framework implementations and explained exactly how the new core property standardizes everything. The detail about swipeBackEnabled being read once on mount vs. every swipe is excellent context for reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package package: react @ionic/react package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants