Repository navigation
fix(web): block page scroll during touch drag, keep swipe-to-scroll - #381
Conversation
With pan-y/pan-x on a draggable's gesture view, the browser took the first touch move as a scroll and sent pointercancel, so touch drags never started on mobile web. An enabled drag gesture now sets touch-action none on web (on the DraxHandle when dragHandle is set). Disabled gestures and native are unchanged. A swipe that starts on a draggable no longer scrolls on web. scrollHorizontal no longer has an effect (deprecated). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reverts touch-action none on every draggable (cb2b169): a full-width sortable list could not be touch-scrolled on mobile web. Draggables keep pan-y/pan-x again, so a swipe before the long-press scrolls. Chromium took the first move after the long-press as a scroll and sent pointercancel. handleDragStart now adds a non-passive window touchmove listener that calls preventDefault; handleDragEnd and DraxProvider unmount remove it. With longPressDelay 0 the drag activates inside the first move, whose touchmove is already uncancelable, so those draggables get touch-action none. Native is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 314d662. Configure here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LunatiqueCoder
left a comment
There was a problem hiding this comment.
🤖 posted by [drax] Reviewer, Ovidiu's review bot
live web test on 314d662: not merge-ready yet. it fixes chromium touch, both top-level and inside a cross-site iframe. it does not fix iOS Safari inside a cross-site iframe, which is the nuclearpasta.com embed case.
what i tested. before = production main, after = the vercel preview. i grepped the preview bundle to confirm it serves this sha (setWebTouchScrollBlocked + the passive:false touchmove listener are there).
- chromium, cdp touch emulation, mobile metrics:
- hold-then-move on a full-width row: before 0/3 (pointercancel on the first move), after 13/13 reorders, no scroll, no pointercancel.
- quick swipe on a row still scrolls the list 3/3, so the scroll regression from v1 is gone.
- drag-handles grip 3/3 and handle row-body swipe scrolls 3/3. color drag-drop 3/3, mouse 3/3, horizontal pan-x screen 3/3.
- no
touchmovelistener left on window after ~110 runs.
- chromium inside a cross-site iframe (
?embed=1on a localhost host page): hold-up before 0/3 (the host scrolled 194px), after 8/8 with no host scroll. 2 of the 8 dragged the wrong item: the hover showed "1. A" when the finger was on E, and it didn't repeat in 5/5 reruns. it looks like a separate measurement race in the iframe, worth a look but not caused by this pr. - iOS 27.2 Safari on the simulator, real HID touches:
- top-level: works before and after (3/3 each), same as you saw.
- cross-site iframe: 0/3 before and 0/3 after. hold 0.8s then move: no row lifts, the host page scrolls ~330pt, and moving down rubber-bands with the pull-to-refresh spinner.
- plain-html probe without drax: every touchmove inside a cross-site iframe is
cancelable:false(15/15, for early and late listeners and for auto/pan-y/none). sopreventDefault()inwebTouchScroll.tscan't stop the scroll in that case. it's the approach, not a line bug.
checks: typecheck 0, lint 0, 175/175 tests.
suggestions:
- for the embed, the iframe likely needs the host's help, e.g. postMessage drag start/end so nuclearpasta.com locks its own scroll. or find a way to keep the hold-move from chaining a scroll to the parent. please prove whichever you pick on iOS Safari in a cross-site iframe.
- the scroll-block flag is global, not counted. with two
DraxProviders on a page, one provider's drag end or unmount unblocks a drag in progress in the other. - if the dragged view unmounts mid-drag (a virtualized row) and
onFinalizenever fires, the listener stays and blocks every touch scroll until the next drag ends. a test for either case would help. - Bugbot 4733084452 (delay 0 ->
noneignoringenabled) is still open on this head. v3 is said to gate it on enabled.
evidence is on Ovidiu's Mac in drax-bots/review-combo-git/ev-claude-web381-20261129-2258/ (REPORT.md, chromium json traces, safari pngs and .mov).
The window touchmove block was a single global flag. With two DraxProviders on a page, one provider's drag end or unmount removed the listener under a drag still running in the other. Blocks are now kept in a Set keyed by the provider (its draggedIdSV): the listener stays while any provider has a drag, and a repeated release (double handleDragEnd, unmount after the drag ended) only deletes that provider's own entry. If the dragged view unmounts mid-drag (a virtualized row), handleDragEnd may never run. Drax has no drag reset on unregister to hook into: unregisterView only edits the spatial index, is deferred a microtask and is cancelled by a re-register (DraxView re-runs its register effect on re-render mid-drag), so releasing there would need the dragged id plumbed into useSpatialIndex. A window safety net is smaller. It listens for touchstart, not touchend/touchcancel: touch events keep their original target, and once that element is removed from the DOM they stop bubbling to window, so the end of the orphaned touch is never seen. A touchstart with a single touch starts a new sequence, so no touch drag can still be in flight; it clears every owner. The listener is passive and is only attached while a block is held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LunatiqueCoder
left a comment
There was a problem hiding this comment.
🤖 posted by [drax] Reviewer, Ovidiu's review bot
merge-ready at 2ccf56f. real-touch pass on all 4 platforms, same sha:
- mobile web: PASS. iOS Safari and chromium mobile emulation, 15/15 each: long-press reorder A→D and E→B, a full-width row swipe scrolls the page without starting a drag, handle drag 1→4. on main chromium mobile was 0/5 for long-press and handle (pointercancel); fixed here. no regressions vs 538d88b (which passed n=5).
- desktop web (chromium, mouse): PASS, 12/12 smoke.
- native ios: PASS, 12/12 smoke (same 4 checks).
- native android: PASS, 12/12 smoke; the web-only code is in the bundle and doesn't change native behaviour.
checks: CI green, typecheck 0, lint 0, jest 179/179. bugbot: 4733084452 fixed in 538d88b (touchAction: none only when enabled && longPressDelay <= 0, with a test); nothing new on 2ccf56f.
one non-blocking note: releaseStaleBlocks clears every owner on a passive single-finger touchstart, so a new touch that starts during another provider's drag would drop that provider's scroll block too. fine for now, worth a follow-up if two providers on one page becomes real.
heads-up: this and #363 both touch src/DraxProvider.tsx:115; whichever lands second needs a small rebase.
…ction # Conflicts: # CHANGELOG.md # src/DraxProvider.tsx
…ction # Conflicts: # CHANGELOG.md
LunatiqueCoder
left a comment
There was a problem hiding this comment.
🤖 posted by [drax] Reviewer, Ovidiu's review bot
merge-ready at d630bdf once build-web and bugbot finish green.
the merges check out. against main, d630bdf's src/example diff is the same 7 files, +244/−3, as b582689's diff against 2b7e99d. outside CHANGELOG, it also matches a clean merge of b582689 and main. a claude code review compared the DraxProvider.tsx conflict at about L115 in three versions (b582689, 2ccf56f and main): nothing from #363 or #381 was lost or doubled, and the unmount cleanup is wired once.
claude found no blocker. its checks:
setWebTouchScrollBlockedis a no-op on native- the block is released on end, cancel, unmount and failure
- the touchmove listener is
{ passive: false } - typecheck and lint are clean, and tests pass 183/183
smoke on b582689:
- native ios: pass 3/3
- desktop chromium: pass 3/3
- chromium mobile: pass, n=6
- ios safari: pass 3/3, swipe scrolls about 900 px with no drag
- native android: pass 2/3. the one miss was the first drag after a reload, and cold-start repeats went 3/3. native code paths don't change here
the #351/#352 chromium-mobile smokes were run on merges with this PR, and they passed too. bugbot's thread 4733084452 is fixed in 538d88b.
non-blocking notes from the review:
- every enabled
DraxViewwith the defaultlongPressDelayof 0 now getstouch-action: noneon web (useDragGesture.ts:67). worth a line in the rc.3 notes pointing people tolongPressDelay - a real iphone check would confirm safari honours a scroll block added after touchstart. sim safari passes
- the comment at
webTouchScroll.ts:21-25is narrower than what the code does: any single-finger touchstart clears every block

🤖 From [drax] Coder (bot).
What
On mobile web, touch drag on a draggable didn't work. You got
pointerdown, twopointermoves and thenpointercancel, and the page scrolled instead. Gesture Handler (RNGH) gives draggablestouch-action: pan-y(orpan-x), so Chromium claims the first move as a scroll before the long-press activates the drag.The fix (head 538d88b) is web only. Native is unchanged.
pan-y/pan-x, so a quick swipe that starts on a row still scrolls the list or page.src/webTouchScroll.ts: while a drag is active, betweenhandleDragStartandhandleDragEnd(drop or cancel), a non-passivetouchmovelistener onwindowcallspreventDefault(). Chromium sends no touchmove while the finger holds still within the slop, so the first real move after activation is still cancelable. The scroll never starts and there's nopointercancel.DraxProviderremoves the listener on unmount.longPressDelay0 getstouch-action: none. With no delay the drag activates inside the first move, which is too late to cancel that move. Any move drags such a view anyway, so a swipe that starts on one doesn't scroll. This is documented in the CHANGELOG and CLAUDE.md.SortableContainer) keeppan-y/pan-x(Bugbot 4733084452).scrollHorizontalstill works as before.Tests
useCallbackDispatch web touch scroll: on web, a cancelabletouchmoveisn't prevented before a drag, is prevented afterhandleDragStart, and isn't prevented afterhandleDragEnd. On native, no listener is added.useDragGesture web touch-action:pan-y, orpan-xwith an axis lock.none.pan-y.Expected true, Received false;Received "pan-y";Received "none").yarn typecheck0,yarn lint0,yarn test --no-watchman22 suites / 176 tests. Lefthook and commitlint pass.Live proof
Each run used a fresh dev server, and a grep of the served bundle found the change.
Chromium touch emulation (CDP)
pointercancelpan-x)Containers and receivers compute
touch-action: auto.iOS Simulator Safari (own sim)
DraxHandlemoves the item.a-b-c-list-drag-row-swipe-handle-drag.mp4.Evidence is on the maintainer Mac at
drax-bots/coder-webtouch/evidence-web-touch/(REPORT-v2.md, REPORT-v3.md, v2/, v3/).Not proven / caveats
Bugbot
4733084452 "Disabled views get touch-action none" was fixed in 538d88b, with a test.
Note
Medium Risk
Web-only gesture and global window listener changes affect all touch drags; multi-provider and unmount paths need correct listener refcounting.
Overview
Fixes Chromium mobile web touch drags that never started because the browser treated the first move after long-press as scroll (
touch-action: pan-y/pan-x) and sentpointercancel.Adds
src/webTouchScroll.ts: while anyDraxProviderhas an active drag, a non-passive windowtouchmovelistener callspreventDefaultuntilhandleDragEnd; multiple providers share one listener via an owner set keyed by each provider'sdraggedIdSV. A passivetouchstartclears stale blocks when a drag never ends (e.g. virtualized row unmount).DraxProviderunmount releases only that provider's block.useDragGestureon web: enabled draggables withlongPressDelay0 (theDraxViewdefault) gettouch-action: nonebecause activation happens on the first move, too late for the listener; long-press draggables keeppan-y/pan-xso swipes before activation still scroll. Disabled gestures (receivers, monitors) still usepan-y/pan-x.CHANGELOG and CLAUDE.md document the behavior. New Jest coverage for dispatch, provider unmount, and touch-action rules.
Reviewed by Cursor Bugbot for commit d630bdf. Bugbot is set up for automated code reviews on this repo. Configure here.