From b0ce345c303a7c628a8dc376d3fbc5cfd2b60c6b Mon Sep 17 00:00:00 2001 From: juan Date: Sun, 22 Mar 2026 23:40:25 -0700 Subject: [PATCH] Reduce hold delay to 800ms and prevent text selection during hold 1000ms was long enough to trigger browser text selection before drag activated. Reduced to 800ms and added userSelect:none on the section during the touch hold period, restored when touch ends. Co-Authored-By: Claude Opus 4.6 --- .../controllers/dashboard_sortable_controller.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/dashboard_sortable_controller.js b/app/javascript/controllers/dashboard_sortable_controller.js index 57192f0b1..b74142154 100644 --- a/app/javascript/controllers/dashboard_sortable_controller.js +++ b/app/javascript/controllers/dashboard_sortable_controller.js @@ -5,7 +5,7 @@ export default class extends Controller { // Hold delay to require deliberate press-and-hold before activating drag mode static values = { - holdDelay: { type: Number, default: 1000 }, + holdDelay: { type: Number, default: 800 }, }; connect() { @@ -98,6 +98,10 @@ export default class extends Controller { this.currentTouchY = this.touchStartY; this.holdActivated = false; + // Prevent text selection while waiting for hold to activate + section.style.userSelect = "none"; + section.style.webkitUserSelect = "none"; + // Start hold timer this.holdTimer = setTimeout(() => { this.activateDrag(); @@ -183,6 +187,16 @@ export default class extends Controller { } resetTouchState() { + // Restore text selection + if (this.pendingSection) { + this.pendingSection.style.userSelect = ""; + this.pendingSection.style.webkitUserSelect = ""; + } + if (this.draggedElement) { + this.draggedElement.style.userSelect = ""; + this.draggedElement.style.webkitUserSelect = ""; + } + this.isTouching = false; this.draggedElement = null; this.pendingSection = null;