Skip to content

fix(input): scroll assist no longer fires duplicate click events#31124

Merged
ShaneK merged 3 commits intomainfrom
FW-6540
May 8, 2026
Merged

fix(input): scroll assist no longer fires duplicate click events#31124
ShaneK merged 3 commits intomainfrom
FW-6540

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented May 7, 2026

Issue number: resolves #30412


What is the current behavior?

When a user listener bound to ion-input or ion-item receives a tap that requires scroll assist to scroll the input into view, the click handler fires twice. Programmatic setFocus() and keyboard focus into an offscreen input also dispatch a phantom click event the developer didn't request.

The cause is scroll-assist.ts: after relocateInput moves the native input, a RAF-scheduled componentEl.click() re-emits a click on the host. That recovery was added in #22845 (Feb 2021) to fix #21871, when scroll assist drove focus from its own touchstart/touchend listeners and relocateInput ran during the in-flight click event's lifecycle.

What is the new behavior?

The RAF recovery click is removed. #25848 (Sep 2022) restructured scroll assist to react to focusin rather than drive focus from touch events, so relocateInput now runs strictly after the click event has finished propagating. Combined with ion-input's click capture handler and ion-item's click-on-padding handler from #30373 (April 2025), the click is always dispatched on the component host before scroll assist runs. Re-firing it produced duplicate clicks for user interactions and phantom clicks for programmatic and keyboard focus.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Regression coverage in core/src/components/input/test/item/scroll-assist-double-click.e2e.ts covers four cases on iOS Mobile Safari and Mobile Chrome: padding click, direct input click, programmatic setFocus(), and keyboard focus. The first two assert one click event; the last two assert zero. All four fail without this change and pass with it.

Preview:

@ShaneK ShaneK requested a review from a team as a code owner May 7, 2026 18:08
@ShaneK ShaneK requested a review from gnbm May 7, 2026 18:08
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

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

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 7, 2026 7:56pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label May 7, 2026
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

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 May 8, 2026
Merged via the queue into main with commit 4670996 May 8, 2026
52 checks passed
@ShaneK ShaneK deleted the FW-6540 branch May 8, 2026 13:05
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-item click event emitted two times when a scroll is needed (with ion-input) bug: scroll assist cancels first click event

2 participants