From 31a5ac156b5bd8c7f5c9f6070a9c2a9411cb9f08 Mon Sep 17 00:00:00 2001 From: juan Date: Tue, 17 Mar 2026 16:20:37 -0700 Subject: [PATCH] Increase hold delay to 750ms and use Euclidean distance for cancellation Use total distance (diagonal-aware) instead of per-axis thresholds to better detect scrolling gestures that travel diagonally. Co-Authored-By: Claude Opus 4.6 --- app/javascript/controllers/dashboard_sortable_controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/controllers/dashboard_sortable_controller.js b/app/javascript/controllers/dashboard_sortable_controller.js index dfaa1e1c7..06731b858 100644 --- a/app/javascript/controllers/dashboard_sortable_controller.js +++ b/app/javascript/controllers/dashboard_sortable_controller.js @@ -113,11 +113,12 @@ export default class extends Controller { const touchX = event.touches[0].clientX; const touchY = event.touches[0].clientY; - // If hold hasn't activated yet, cancel it if user moves too far (they're scrolling) + // If hold hasn't activated yet, cancel if user moves too far (scrolling or swiping) + // Uses Euclidean distance to catch diagonal gestures too if (!this.holdActivated) { const dx = touchX - this.touchStartX; const dy = touchY - this.touchStartY; - if (Math.abs(dx) > 10 || Math.abs(dy) > 10) { + if (dx * dx + dy * dy > 100) { // 10px radius this.cancelHold(); } return;