Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

improve mobile support for drag and drop

Kha Nguyen07945f946dc9
diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsx
index 0d7fe46b..146ebc47 100644
--- a/apps/web/pages/dashboard.tsx
+++ b/apps/web/pages/dashboard.tsx
@@ -34,6 +34,10 @@ import {
DragStartEvent,
DragOverlay,
DragOverEvent,
+ useSensor,
+ MouseSensor,
+ TouchSensor,
+ useSensors,
} from "@dnd-kit/core";
import { restrictToWindowEdges } from "@dnd-kit/modifiers";
import Droppable from "@/components/Droppable";
@@ -55,6 +59,22 @@ export default function Dashboard() {
const pinLink = usePinLink();
const queryClient = useQueryClient();
+ const mouseSensor = useSensor(MouseSensor, {
+ // Require the mouse to move by 10 pixels before activating
+ activationConstraint: {
+ distance: 10,
+ },
+ });
+ const touchSensor = useSensor(TouchSensor, {
+ // Press delay of 250ms, with tolerance of 5px of movement
+ activationConstraint: {
+ delay: 200,
+ tolerance: 5,
+ },
+ });
+
+ const sensors = useSensors(mouseSensor, touchSensor);
+
const [numberOfLinks, setNumberOfLinks] = useState(0);
const [activeLink, setActiveLink] =
useState<LinkIncludingShortenedCollectionAndTags | null>(null);
@@ -301,6 +321,7 @@ export default function Dashboard() {
onDragOver={handleDragOver}
onDragCancel={handleDragOverCancel}
modifiers={[restrictToWindowEdges]}
+ sensors={sensors}
>
<MainLayout>
{!!activeLink && (