PointerSensor ends a drag without applying the last pointer move, so the drop lags the release by one frame
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start in @dnd-kit/[email protected]/index.js at PointerSensor.handlePointerMove, handlePointerUp, and cleanup, and read the scheduler in utilities.js around line 779 to see how handleMove is queued. Reproduce with a Playwright drag that calls mouse.down(), mouse.move(x, y), then mouse.up() without waiting, logging event.operation.target?.id and event.operation.transform in dragend. Done means handlePointerUp applies this.latest or the pointerup coordinates before actions.stop, so dragend reflects the release position.
Written by the indexing model from the issue text.
Description
@dnd-kit/dom 0.5.3
A drop resolves against the pointer position of the last animation frame, not the position where the pointer was released. If the pointer moves and is released within the same frame, the final move is dropped: dragend reports the previous transform and the previous target.
Where it comes from (line numbers are @dnd-kit/[email protected]/index.js)
PointerSensor.handlePointerMoverecords the move inthis.latestand scheduleshandleMovefor the next animation frame (scheduler.schedule(this.handleMove), line 2206; the scheduler usesrequestAnimationFrame,utilities.jsline 779).handlePointerUp(lines 2210-2232) callsthis.manager.actions.stop({ event, canceled })without applying the pendingthis.latestmove first.- It then calls
this.cleanup(), which resetsthis.latest(line 2306), so when the scheduledhandleMoveruns it returns early (lines 2085-2088) and the move is never applied.
So position.current, the transform derived from it, and the collision that picks the drop target all stay one frame behind the release.
How to see it
- Register one draggable and two droppables side by side, and log
event.operation.target?.idandevent.operation.transformin adragendlistener. - With a scripted pointer (for example Playwright's
mouse.down(),mouse.move(x, y),mouse.up()with no wait between the last move and the release), drag from the draggable onto the second droppable. dragendreports the target and transform from the move before the last one; the finalpointermoveis not reflected. A hand drag that keeps moving until the release shows the same lag, by at most one frame of pointer travel.
Expected
dragend reflects the release position: handlePointerUp applies the pending move (or the pointerup coordinates) before calling actions.stop.
- Dominant language
- TypeScript
- Stars
- 17.8k
- Forks
- 934
- Avg merge
- 12h 5m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from clauderic/dnd-kit
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Accessibility plugin does O(n²) DOM reads when many draggables mountPossibly taken @dev-noman claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Accessibilty plugin statuses are always in `document.body`Possibly taken @dev-noman claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
clauderic/dnd-kit#2185 · 1 comment ·
Maintainers usually reply within 1 day
-
Declare @types/react as an optional peer dependencyPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
DndContext does not detach the active sensor when it unmounts mid-dragPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
clauderic/dnd-kit#2179 · 1 comment ·
Maintainers usually reply within 1 day
All issues in clauderic/dnd-kit
Similar issues
-
MCP tool results drop structuredContent when text is only a summaryPossibly taken @Pankaj-bit361 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
inblockio/siwx-oidc-matrix-server#101 ·
Maintainers usually reply within 1 day
-
status:needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pingdotgg/t3code#42253 · 1 comment ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
LangerSword/gitone#7 ·