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

Other elements are no longer dragged when Tree component is rendered

santanamic opened this issue · comments

Describe the bug
I'm trying to use other drag and drop components on the same screen as the treeview component.

However, for any custom HTML element that I set the draggable attribute to, the drag functionality is lost. This only happens when the treeview component is rendered in the same view.

To Reproduce
Try dragging some of the custom elements:
https://codesandbox.io/embed/minimum-configuration-js-forked-c8uk64?fontsize=14&hidenavigation=1&theme=dark

Expected behavior
The element drag and drop should happen (OnDrag). This only works when I remove the Tree component.

  • Browser Firefox
  • Version 102.01

@santanamic

This problem is caused by the dependency package react-dnd. The same issue is reported in the following Issue.

react-dnd/react-dnd#3304

This problem can be avoided by specifying rootElement in the DnDProvider option and limiting the scope of react-dnd.
Please refer to the sample code we have created below.

https://codesandbox.io/s/issue164-zv2889?file=/src/App.jsx