Skip to content

fix(gesture): remove leaked optsTest listener from passive support check - #31363

Merged
ShaneK merged 1 commit into
mainfrom
FW-6675
Aug 18, 2026
Merged

fix(gesture): remove leaked optsTest listener from passive support check#31363
ShaneK merged 1 commit into
mainfrom
FW-6675

Conversation

@ShaneK

@ShaneK ShaneK commented Aug 17, 2026

Copy link
Copy Markdown
Member

Issue number: resolves #30539


What is the current behavior?

Currently, supportsPassive in the gesture listener utils detects passive listener support by attaching a real optsTest listener to the element and reading the passive getter, but it never removes that listener. The result is a listener permanently attached to whichever element runs the first gesture.

There's a second failure mode in the same function. The _sPassive === undefined guard only clears if the getter fires or if addEventListener throws, so a runtime that does neither leaves _sPassive undefined and every subsequent call attaches another optsTest listener that's never cleaned up.

What is the new behavior?

We now always pass the options object, and the detection is removed entirely. The check was already dead code, because passive options object support landed in Chrome 51, Safari 10, Firefox 49, and Edge 16, all in 2016, while our lowest supported versions are Chrome 89, Safari 15, Firefox 75, and Edge 89. The function returned true on every browser we support, so both branches of the removed ternary collapse to the same value and there's no behavior change.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@ShaneK
ShaneK requested a review from a team as a code owner August 17, 2026 19:52
@ShaneK
ShaneK requested a review from thetaPC August 17, 2026 19:52
@vercel

vercel Bot commented Aug 17, 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 Aug 17, 2026 7:57pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Aug 17, 2026
@ShaneK
ShaneK requested review from brandyscarney and removed request for thetaPC August 17, 2026 20:07

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ShaneK
ShaneK added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit c689000 Aug 18, 2026
51 checks passed
@ShaneK
ShaneK deleted the FW-6675 branch August 18, 2026 19:14
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: "optsTest" event listener memory leak

2 participants