fix(board): slow the edge auto-scroll while dragging a card on mobile#47
Merged
Conversation
With a card held at the board's left/right edge, dnd-kit's default auto-scroll
(acceleration 10) pans the column strip at ~2000px/s — far too fast to land in
the intended column on a phone, where only ~one column is visible at a time, so
moving a card across columns overshoots constantly.
Pass autoScroll={{ acceleration: 5 }} to DndContext to halve the top edge-scroll
speed (~800px/s measured) while keeping the smooth 5ms scroll cadence — lowering
acceleration caps speed without the choppiness that raising `interval` would add.
acceleration is the single knob to dial further if it's still fast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the board mobile-drag work (#46). Now that dragging a card works on touch, holding it at the board's left/right edge to reach another column auto-scrolls far too fast to land in the column you want — on a phone only ~one column is visible at a time, so it overshoots constantly.
Cause
dnd-kit's edge auto-scroll runs
scrollBy(acceleration)everyinterval(5ms). At the defaultacceleration: 10that's ~2000 px/s.Fix
autoScroll={{ acceleration: 2 }}onDndContext— caps the edge-scroll at ~320 px/s (≈ one column per second) while keeping the smooth 5 ms cadence. Loweringaccelerationcaps speed without the choppiness that raisingintervalwould add; it's the single knob to dial.Verification
tsc -bclean;bun run test→ 84 pass.scrollLeftover an edge-hold with real touch events (CDP, 390px): measured ~340 px/s (default was ~2000; an earlier acceleration-5 pass measured ~800 and still felt too fast). Tap-to-open and within-column reorder unaffected.