Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Fix drag & drop (#999)

Roman Pominov1d3dfe8fee99
diff --git a/packages/design-system/src/components/tree/tree.tsx b/packages/design-system/src/components/tree/tree.tsx
index 483e84eac4..a1c98b6710 100644
--- a/packages/design-system/src/components/tree/tree.tsx
+++ b/packages/design-system/src/components/tree/tree.tsx
@@ -159,10 +159,15 @@ export const Tree = <Data extends { id: string }>({
},
getValidChildren: (element) => {
+ // NOTE:
+ // redefining children like this will screw up automatic childrenOrientation detection
+ // luckily we know the orientation and can define it manually below
return Array.from(
element.querySelectorAll(":scope > div > [data-drop-target-id]")
);
},
+
+ childrenOrientation: { type: "vertical", reverse: false },
});
const dragHandlers = useDrag<Data>({