Drag to reorder lets people pick up an item in a list and drop it in a new place, while the other items slide out of the way.
Drag to reorder is how a playlist, a to-do list or a set of tabs gets rearranged: press an item, move it, and the items it passes slide aside to show where it will land. On release it settles into the gap.
Use pointer events with setPointerCapture so the drag keeps tracking outside the item, set touch-action: none on the handle so the page does not scroll instead, move the dragged item with transform, and animate the others with FLIP as the order changes.
It must work without a pointer too. A common pattern: focus an item, press Space or Enter to pick it up, use the arrow keys to move it, and press Space again to drop it, announcing each move in a live region (“Moved to position 3 of 8”).
handle.addEventListener('pointerdown', (e) => {
handle.setPointerCapture(e.pointerId);
const startY = e.clientY;
const move = (ev) => { item.style.transform = `translateY(${ev.clientY - startY}px)`; };
handle.addEventListener('pointermove', move);
handle.addEventListener('pointerup', () => {
handle.removeEventListener('pointermove', move);
item.style.transform = ''; // drop: update the order, then FLIP the siblings
}, { once: true });
});