Tree Drag & Drop: Child item can't be moved to root if only one root item #9796
Replies: 2 comments 3 replies
|
I spent a bit of time looking at this today. I see the issue as well, following your instructions, but I'm not sure where the issue is yet. Because it works if there are other items, it doesn't seem to be related to the drop above being too thin because that space is the same in both cases. In other places I can drop before a parent key, so it's likely not related to that. |
|
I spent some time in In Then in if (currentItem?.nextKey != null) {
return [originalTarget];
}Root's Compare that to the other two paths in the same function: the "before first child" path ( So the single-root case is the only shape where a tree hits that specific unvalidated early return with a Not confident this is the whole story since I haven't run it against your Stackblitz repro, but adding |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm using the RAC Tree component with drag & drop support. If the tree contains a single root item with children, I can't move the child item to the root before the current root item.
The drag indicator doesn't appear but dropping the item at the ~right position calls
onMovewith an invalid target keyreact-aria-1. The child can be moved to the root after the root item and from there (with two items in the root) it can be moved before the root item.I opened the Tree - Moving items demo in Stackblitz and changed the data to have a single root item. It can be reproduced here.
rac-tree-dnd.mov
Repro: https://stackblitz.com/edit/csdzuzrl?file=src%2FExample.tsx
Is my code (and the demo in the docs) wrong or is this a bug in React Aria?
Regards,
Sandro
All reactions