Skip to content

fix(gesture): do not re-enable a destroyed gesture - #31788

Open
aliassar wants to merge 1 commit into
ionic-team:mainfrom
aliassar:fix-sheet-gesture-after-destroy
Open

aliassar wants to merge 1 commit into
ionic-team:mainfrom
aliassar:fix-sheet-gesture-after-destroy

Conversation

@aliassar

Copy link
Copy Markdown

Issue number: resolves #31786


What is the current behavior?

If a sheet modal is dismissed while a breakpoint move is still animating, the move's finish callback calls gesture.enable(true) after dismiss() has already destroyed the gesture. destroy() clears the pointer callbacks, but enable(true) still adds the touchstart and mousedown listeners back. An inline modal reuses the wrapper, so after the next present every touch on the sheet throws pointerDown is not a function.

What is the new behavior?

  • createPointerEvents remembers that it was destroyed, and enable(true) does nothing after destroy().
  • Fixing it in the shared pointer events util covers every caller that might re-enable late, not just the sheet breakpoint move.
  • Added a spec test that checks no listeners are added when enable(true) runs after destroy().

Does this introduce a breaking change?

  • Yes
  • No

Other information

I ran the reproduction from the issue against a local dev build in headless Chrome with touch on (390x844), tapping the sheet 3 times after the second present. In iOS mode each tap threw pointerDown is not a function before the change and nothing after it, and dragging the re-presented sheet still moved it from 0.4 to 1. MD mode doesn't hit this because its shorter leave animation destroys the move animation before the move finishes.

A sheet modal that is dismissed while a breakpoint move is animating
can have its gesture re-enabled after dismiss destroyed it. The pointer
callbacks are already cleared at that point, so every later touch or
mouse down on the reused wrapper throws "pointerDown is not a function".

Keep track of destroy in createPointerEvents so enable(true) does not
add listeners again once the gesture is destroyed.

closes ionic-team#31786

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aliassar
aliassar requested a review from a team as a code owner November 19, 2026 21:07
@aliassar
aliassar requested a review from thetaPC November 19, 2026 21:07
@github-actions github-actions Bot added the package: core @ionic/core package label Nov 19, 2026
@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@aliassar is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

bug: ion-modal sheet throws "pointerDown is not a function" on touch

1 participant