clauderic / clauderic/react-sortable-hoc

Dynamically adding list items to the list while dragging an item breaks the UX behaviour

Open
#355 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

I'm working on drag&drop function in a tree view with collapsible tree nodes. The tree is represented with a list, and each item has its indent, making it look like a tree.

When mouse-hovering a collapsed tree item for 1 second, I expand it, which means more items are added dynamically to the list.

Once more items are added, the drag&drop UX experience breaks and makes it not possible to continue dragging and end up with any useful drag&drop result.

In the following screenshot, we start with 2 sections: Mother (collapsed) and Father expanded.

![image](https://user-images.githubusercontent.com/282177/37443694-8dd54952-285d-11e8-9d77-1b9b252ca8bd.png)

After dragging "Father's other names" over Mother section, and holding for a second, the latter expands, and 4 new items are added dynamically.

After that, we continue to drag the element that is being dragged, but the UI is broken:

![image](https://user-images.githubusercontent.com/282177/37443658-54d4d294-285d-11e8-8419-748172f8c178.png)

It would be nice to have some sort of a {{reIndex()}} callback that one can call after changing the content of the list (i.e. adding /removing sortable items, resizing them etc).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.