minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Manual Sort: When tree is scrollable scrolling to bottom and then dragging any node results in the placeholder being in the wrong place, offset by the scroll distance.

eoinomeara11 opened this issue · comments

Manual Sort: When tree is scrollable scrolling to bottom of tree and then dragging any higher node results in the placeholder being in the wrong place, offset by the original scroll distance. Bug.

@eoinomeara11 Thanks for the report.

After checking, we found that some of the CSS in the sample was incorrect: the top: 0 was not mentioned in the style of the placeholder component, and the position: relative was not set on the parent element.

I have fixed sample code of placeholder.
I have also created a sandbox for checking this fix here, so please check it out.
https://codesandbox.io/s/issue91-xi1dl?file=/src/App.jsx

The fixed part is that

classes={{ root: styles.treeRoot
    root: styles.treeRoot,
    draggingSource: styles.draggingSource,
    placeholder: styles.placeholderContainer
}}

I added position: relative to the class styles.placeholderContainer above.
And also added top: 0; to the class written in Placeholder.module.css.

Please check it out.