Skip to content

fix(modal): prevent sheet gesture crash with late-bound breakpoints#31202

Open
ShaneK wants to merge 1 commit into
mainfrom
fix/modal-late-breakpoints
Open

fix(modal): prevent sheet gesture crash with late-bound breakpoints#31202
ShaneK wants to merge 1 commit into
mainfrom
fix/modal-late-breakpoints

Conversation

@ShaneK

@ShaneK ShaneK commented Jun 9, 2026

Copy link
Copy Markdown
Member

Issue number: internal


What is the current behavior?

Currently, when an ion-modal's breakpoints are set after the component has loaded, sortedBreakpoints stays empty. breakpointsChanged had no @Watch, so it only ran once from the manual call in componentDidLoad. present() still recalculates isSheetModal to true from the late-set breakpoints (added in #30839), so the sheet gesture initializes with an empty breakpoints array and throws Reduce of empty array with no initial value on the breakpoints.reduce(...) in sheet.ts when the sheet is swiped, which breaks swiping entirely.

This shows up with framework bindings that land after the web component loads, e.g., an inline ion-modal inside an Angular component rendered through a plain router-outlet with zoneless change detection. It doesn't reproduce with zone change detection, with ModalController.create, or with the modal inside ion-router-outlet, since those set breakpoints before the modal presents.

What is the new behavior?

Now breakpointsChanged has @Watch('breakpoints'), so breakpoints set after the component loads update sortedBreakpoints. This mirrors how trigger/triggerChanged already handles late binding (a watch plus a manual call in componentDidLoad). The sheet gesture then gets the real breakpoints and swiping works.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Sheet modal preview:

Note that the preview won't show this working, but will show the modal at least isn't broken from this change.

Current dev build:

8.8.10-dev.11781019195.14a7eeaf

@ShaneK ShaneK requested a review from a team as a code owner June 9, 2026 15:30
@ShaneK ShaneK requested a review from BenOsodrac June 9, 2026 15:30
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Jun 9, 2026 3:30pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Jun 9, 2026

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants