From f8895dacdaa4365c1a9163690a4a33a9ae897511 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 17 Sep 2022 19:23:25 -0400 Subject: [PATCH] fix: Don't redirect to document after dragging pin --- app/components/DocumentCard.tsx | 2 ++ app/components/PinnedDocuments.tsx | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/DocumentCard.tsx b/app/components/DocumentCard.tsx index c9c173d92..98f0ec84b 100644 --- a/app/components/DocumentCard.tsx +++ b/app/components/DocumentCard.tsx @@ -69,6 +69,7 @@ function DocumentCard(props: Props) { $isDragging={isDragging} {...attributes} {...listeners} + tabIndex={-1} > ` // move above other cards when dragging z-index: ${(props) => (props.$isDragging ? 1 : "inherit")}; + pointer-events: ${(props) => (props.$isDragging ? "none" : "inherit")}; &:hover ${Actions} { opacity: 1; diff --git a/app/components/PinnedDocuments.tsx b/app/components/PinnedDocuments.tsx index 31cbda5aa..7cd35ba52 100644 --- a/app/components/PinnedDocuments.tsx +++ b/app/components/PinnedDocuments.tsx @@ -44,7 +44,7 @@ function PinnedDocuments({ limit, pins, canUpdate, ...rest }: Props) { const sensors = useSensors( useSensor(PointerSensor, { activationConstraint: { - delay: 150, + delay: 100, tolerance: 5, }, }), @@ -59,8 +59,8 @@ function PinnedDocuments({ limit, pins, canUpdate, ...rest }: Props) { if (over && active.id !== over.id) { setItems((items) => { - const activePos = items.indexOf(active.id); - const overPos = items.indexOf(over.id); + const activePos = items.indexOf(active.id as string); + const overPos = items.indexOf(over.id as string); const overIndex = pins[overPos]?.index || null; const nextIndex = pins[overPos + 1]?.index || null;