From ccd754dd817c2feadb18d01812e2d2d7352634ea Mon Sep 17 00:00:00 2001 From: rd-code-23 Date: Sat, 12 Sep 2026 14:30:05 -0700 Subject: [PATCH] fix(web): enable routine reordering on touch devices --- apps/web/package.json | 1 + .../create/editor/routine-exercise-list.tsx | 15 +++++++++++++++ pnpm-lock.yaml | 3 +++ 3 files changed, 19 insertions(+) diff --git a/apps/web/package.json b/apps/web/package.json index a241576..12a54fe 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -12,6 +12,7 @@ "test": "vitest run" }, "dependencies": { + "@dnd-kit/dom": "^0.5.0", "@dnd-kit/helpers": "^0.5.0", "@dnd-kit/react": "^0.5.0", "@goforlift/contracts": "workspace:*", diff --git a/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx b/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx index 7b7963e..c8086ba 100644 --- a/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx +++ b/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx @@ -1,4 +1,9 @@ /** Displays configured exercises in the routine draft. */ +import { + KeyboardSensor, + PointerActivationConstraints, + PointerSensor, +} from '@dnd-kit/dom'; import { DragDropProvider } from '@dnd-kit/react'; import { isSortable, useSortable } from '@dnd-kit/react/sortable'; import { Dumbbell, GripVertical, MoreHorizontal } from 'lucide-react'; @@ -13,6 +18,15 @@ import { import { cn } from '@/lib/utils'; import type { RoutineDraftExerciseFormValues } from '../routine-draft-form'; +const reorderSensors = [ + PointerSensor.configure({ + activationConstraints: [ + new PointerActivationConstraints.Distance({ value: 4 }), + ], + }), + KeyboardSensor, +]; + export function RoutineExerciseList({ exercises, onEdit, @@ -51,6 +65,7 @@ export function RoutineExerciseList({ onReorder(source.initialIndex, source.index); } }} + sensors={reorderSensors} >