Open cwaj400 opened 1 year ago
Having this exact same issue. Tried binding to parent via bounds="parent" and bounds=".container" (class immediately above the
you can set the position to absolute for the dragging item It fixed for me
When I set bounds prop, I can only move the element to right and bottom, I can't move it back to top or left. Why?
Repro:
Using Next.Js - importing : import Draggable, {DraggableCore} from 'react-draggable';
`
When I console log the parent node: console.log(document.getElementById('item').parentNode); I get this component with classname
<div className='border bg-gray-100 h-96'>
which is correct. However, the draggable arrow snaps to the right side of the screen (not the parent), and won't move along the x axis. It should not snap past the parent, and it should move along both axis.UPDATE
The issue here is that the Draggable component is being snapped to the parent - which would be the Sidebar, as this is the strict 'parent' wrapping all children in my react application: `export default function App({Component, pageProps}) { return (
}`
So the question is - how do I bound the draggable component to a specific HTMLElement, i.e. the immediate parent, the container, rather than the top level parent? I am assuming this is the issue here.