What problem does it solve?
Drag-to-reorder with @dnd-kit breaks in non-obvious ways: dragged items stretch to slot width, wrapping rows overlap instead of reflowing, touch gestures fight scrolling, and live reordering causes "Maximum update depth exceeded" loops. This Skill captures the working configuration and the bugs to avoid.
Core Features & Use Cases
- Five core rules: Use CSS.Translate instead of CSS.Transform, pick the sorting strategy by layout (rectSortingStrategy for wrapping grids), split MouseSensor and TouchSensor, apply touch-action: none, and reorder once in onDragEnd with stable IDs and arrayMove.
- Symptom index: Maps common symptoms (stretching, overlap, update-depth errors, touch scroll hijacking) directly to their cause and fix.
- Use Case: When building a row of variable-width preset chips that wraps onto multiple lines and must support tap-to-activate, long-press-to-drag on mobile, and smooth reordering on desktop, apply this Skill to wire DndContext, sensors, and SortableContext correctly the first time.
Quick Start
Use the drag-to-reorder skill to add a sortable, wrapping row of chips with @dnd-kit that works on both desktop and mobile touch.