DragOperation.position.current is one "frame" behind when using Keyboard navigation
- Dominant language
- TypeScript
- Stars
- 17.6k
- Forks
- 924
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
I use the following logic to get the relative position of the dragged element relative to the current drop target:
```
const dragPositionRelativeToTarget = position.current.y < target.shape.center.y ? 'top' : 'bottom';
```
This works fine with mouse sensor, but when using keyboard sensor the value of `position.current.y` is from the "previous key press". Lets assume the following sequence: Up/Up/Down/Down then the first Down is still registered as Up and the `position.current.y` decreases. Edit: The actual position of the DragOverlay is updated correctly though.
Contributor guide
Research direction
Reproduce the issue in the dnd-kit drag operation with the keyboard sensor using the Up/Up/Down/Down sequence, then trace where DragOperation.position.current is updated. Confirm that position.current.y reflects the latest key press while the DragOverlay remains correctly positioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100