fix: pointer-events reordering with touch and keyboard support

HTML5 drag events never fire on touch, so reordering only ever worked with
a mouse.

Pointer events handle mouse, touch and pen in one path. The entry
condition has to differ: a mouse drag starts after 8px of movement, but a
touch drag can't use movement, because a vertical swipe on a list usually
means scroll. Touch starts on a 400ms long press instead, and moving
before that cancels it and lets the page scroll. touch-action applies only
while a drag is live, plus a non-passive touchmove blocker, since
touch-action can't stop a gesture already in flight.

Alt+Up and Alt+Down reorder from the keyboard. Focus is put back on the
moved row by hand, since list reconciliation drops it and the first
version only worked once.

Also removes dataTransfer.setData('text/html', event.target), which passed
a DOM node where a string was required.
This commit is contained in:
Aculix Technologies
2026-08-16 00:13:50 +05:30
parent cf64159322
commit 4c0b6de712
2 changed files with 131 additions and 22 deletions
+4
View File
@@ -276,6 +276,10 @@ body {
.task-item.dragging {
opacity: 0.4;
cursor: grabbing;
/* Only while a drag is actually in flight, so an ordinary touch on a row
still scrolls the page. */
touch-action: none;
user-select: none;
}
.task-item.drag-over::before {