frontend-collective / frontend-collective/react-sortable-tree
Strange behaviour of dropEffect in connection with getNodeKey
- Dominant language
- JavaScript
- Stars
- 5k
- Forks
- 914
- PR merge metrics
- No merged PRs in 30d
Description
I noticed strange behaviour of `getNodeKey` function. Somehow it affects React DND dropEffect and I do not see clear reasons why.
It `getNodeKey` returns key which are numeric then tree always works with **dropEffect: copy** and it is impossible to change it with 'Alt' key.
But when `getNodeKey` return string then tree by default works with **dropEffect:move** and if user press 'Alt' key during drag then it is changed to **dropEffect:copy**
I do like second behariour but I cannot understand why it is working in this way, is it desired effect or side-effect of some bug. I prefer it to work when user can press 'Alt' during drag and drop. As I understand this is functionality of react-dnd library and nice to have.
I made a small example in my fork, I changed "Add and remove nodes programmatically" storybook example just overriding the `getNodeKey` function.
https://github.com/megaboich/react-sortable-tree/commit/88d562e32c0fa20512d9435fab0094c01ab13a3d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.