fix(board): make mobile card drag usable — iOS callout + edge-scroll speed#46
Merged
Merged
Conversation
…o drag
Board cards are wrapped in a <Link> (an <a>). On iOS Safari a long-press on a
link fires the native callout — the "Open / Add to Reading List / Copy Link /
Share" preview menu — and a long-press is exactly the press-and-hold gesture the
TouchSensor uses to begin a drag (D30). So every attempt to drag a card popped
the iOS link menu instead, making drag-to-reorder/-restatus unusable on a phone.
Set `-webkit-touch-callout: none` on the card wrapper (the property is inherited,
so it covers the anchor and its contents) to suppress the callout, plus
`user-select: none` so the long-press doesn't raise the text-selection menu
either, and `draggable={false}` on the anchor to drop its native HTML5 drag
image. A card is a drag handle / navigation target, not selectable copy, so none
of these costs anything. Tap-to-open and the hold-drag reorder are unchanged
(regression-checked); the callout itself is iOS-only and not reproducible in
headless Chromium, so it needs an on-device confirm.
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.
Two related fixes that make dragging a board card actually work on a touchscreen (found while testing on an iPhone after the PROG-79 mobile nav work).
1. iOS link callout hijacked the drag
Board cards are wrapped in a
<Link>(an<a>), and iOS Safari fires its native link callout ("Tap to show preview" + Open / Add to Reading List / Copy Link / Share) on long-press — which is the exact press-and-hold gesture the dnd-kitTouchSensoruses to start a drag (D30). So every drag attempt popped the Safari menu instead.Fix (
BoardCard,Home.tsx):-webkit-touch-callout: noneon the card wrapper (inherited, so it covers the anchor + contents), plususer-select: none(kills the long-press selection menu) anddraggable={false}on the anchor (drops the native drag image). A card is a drag handle / nav target, not selectable copy.2. Edge auto-scroll was way too fast
Once dragging worked, holding a card at the board's left/right edge to reach another column auto-scrolled at dnd-kit's default
acceleration: 10≈ 2000 px/s — impossible to land in the intended column on a phone (only ~one column is visible).Fix:
autoScroll={{ acceleration: 5 }}onDndContext— halves the top edge-scroll speed (~800 px/s measured) while keeping the smooth 5 ms cadence.accelerationis the single knob to dial lower if it still feels fast.Verification
tsc -bclean;bun run test→ 84 pass.-webkit-touch-calloutis WebKit/iOS-only, so headless Chromium can't reproduce the callout — the suppression needs an on-device confirm in iOS Safari (the style object is confirmed applied;user-select:noneis observable in Chromium).