Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit d51ca13

Browse files
committed
Fix iOS long press text selection preventing drag-and-drop
1 parent c1a4d90 commit d51ca13

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

frontend/src/lib/TaskList.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@
172172
return;
173173
}
174174
175+
// Prevent text selection and context menu on iOS
176+
e.preventDefault();
177+
175178
touchStartY = e.touches[0].clientY;
176179
touchStartIndex = index;
177180
touchDragEnabled = false;
@@ -362,15 +365,21 @@
362365
};
363366
const touchMoveHandler = (e) => handleTouchMove(e);
364367
const touchEndHandler = handleTouchEnd;
368+
const contextMenuHandler = (e) => {
369+
// Prevent context menu on long press (iOS)
370+
e.preventDefault();
371+
};
365372
366373
card.addEventListener('touchstart', touchStartHandler, { passive: false });
367374
card.addEventListener('touchmove', touchMoveHandler, { passive: false });
368375
card.addEventListener('touchend', touchEndHandler, { passive: false });
376+
card.addEventListener('contextmenu', contextMenuHandler);
369377
370378
cleanup.push(() => {
371379
card.removeEventListener('touchstart', touchStartHandler);
372380
card.removeEventListener('touchmove', touchMoveHandler);
373381
card.removeEventListener('touchend', touchEndHandler);
382+
card.removeEventListener('contextmenu', contextMenuHandler);
374383
});
375384
});
376385
@@ -573,6 +582,9 @@
573582
574583
.task-card {
575584
transition: all 0.25s ease;
585+
-webkit-user-select: none;
586+
user-select: none;
587+
-webkit-touch-callout: none;
576588
}
577589
578590
.task-wrapper:has(.subtask) {

0 commit comments

Comments
 (0)