Skip to content

fix(app): clean up tap-click and focus-visible listeners on unmount - #31587

Open
rudrakshagarwal4200-ai wants to merge 2 commits into
ionic-team:mainfrom
rudrakshagarwal4200-ai:rudrakshagarwal4200-ai-patch-1
Open

rudrakshagarwal4200-ai wants to merge 2 commits into
ionic-team:mainfrom
rudrakshagarwal4200-ai:rudrakshagarwal4200-ai-patch-1

Conversation

@rudrakshagarwal4200-ai

Copy link
Copy Markdown

Fixes #30094.

Description of Change

  • Clean up tap-click listeners: startTapClick attaches global pointerdown, pointerup, pointercancel, and ionGestureCaptured event listeners directly to document. When <ion-app> is unmounted and remounted (e.g. in Vue 3 component key changes, Storybook, or test environments), new listeners were added without removing previous listeners. This caused multiple ripple effects to stack on top of each other, making ripples appear unnaturally dark or white. startTapClick now returns a cleanup callback, automatically clears any previous listener set before re-attaching, and <ion-app> invokes this cleanup in disconnectedCallback.
  • Clean up focus-visible utility: <ion-app> now invokes this.focusVisible.destroy() on disconnectedCallback, properly removing document keydown, focusin, focusout, touchstart, and mousedown listeners registered by startFocusVisible.

Refactor startTapClick to return a cleanup function and handle undefined doc case.
Add tapClickCleanup to manage tap-click event cleanup.
@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

@rudrakshagarwal4200-ai is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: core @ionic/core package label Oct 16, 2026

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.

IonApp does not clean up event listeners on unmount, causing duplicate ripple effects on remount.

1 participant