Skip to content

Fix tapHold event firing during table scroll on touch devices#4892

Open
rathboma wants to merge 2 commits into
masterfrom
claude/vibrant-keller-ngVuH
Open

Fix tapHold event firing during table scroll on touch devices#4892
rathboma wants to merge 2 commits into
masterfrom
claude/vibrant-keller-ngVuH

Conversation

@rathboma
Copy link
Copy Markdown
Collaborator

@rathboma rathboma commented Jun 4, 2026

Summary

This PR fixes an issue where the tapHold event would incorrectly fire when scrolling a table on touch devices, causing unwanted context menus to appear mid-scroll.

Key Changes

  • Interaction.js: Added clearTimeout() call in clearTouchWatchers() method to properly cancel pending tapHold timers before nullifying them
  • Interaction.spec.js: Added comprehensive test case that verifies tapHold events are not dispatched after table scrolling occurs

Implementation Details

The fix addresses issue #4482 by ensuring that when clearTouchWatchers() is called (which happens during scroll events), any pending tapHold timeout is explicitly cancelled via clearTimeout() before the reference is set to null. This prevents the timeout callback from executing after the user has already started scrolling, which would have been a scroll gesture rather than a hold gesture.

The test replicates the exact scenario: a touchstart event initiates a tapHold timer, then scrolling triggers clearTouchWatchers(), and the test verifies that the tapHold event is never dispatched even after the original 1000ms timeout elapses.

https://claude.ai/code/session_01Y2aoGEPqTv8USRzMe27uHq

claude added 2 commits June 4, 2026 21:40
Add a failing unit test demonstrating that a pending tapHold timer is
not cancelled when the table is scrolled. clearTouchWatchers() nulls the
watcher references but never clears the underlying setTimeout, so the
1000ms tapHold callback still fires after a scroll and dispatches
rowTapHold, opening the row context menu mid-scroll on touch devices.
clearTouchWatchers() nulled the watcher references but never cleared the
underlying timers, so a tapHold timer armed by a touchstart would still
fire ~1s after the user started scrolling, dispatching rowTapHold and
opening the row context menu mid-scroll on touch devices.

Call clearTimeout() on each watcher before nulling it so scrolling
properly cancels the in-flight tap/tapHold gesture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants