Skip to content

Cannot drag a item in a virtualized component if the virtualizer removes the item from the DOM #5336

@LFDanLu

Description

@LFDanLu

Discussed in #5320

Originally posted by hipstersmoothie October 27, 2023
I have a virtualized draggable listbox and it mostly work.

One thing that doesn't is dragging things from the start of the list to the end of the list. If the dragged item gets unmounted while the drag is happening, the useDraggableItem calls it onDragEnd and the drag operation won't work.

Is there any guidance on this?

Looking at the code it looks like useDrag doesn't really depend on the original element still being mounted.

The issue lies in the code below

    // If the dragged element is removed from the DOM via onDrop, onDragEnd won't fire: https://bugzilla.mozilla.org/show_bug.cgi?id=460801
    // In this case, we need to manually call onDragEnd on cleanup
```</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    🔬 To Investigate / Verify

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions