adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
13.11k stars 1.14k forks source link

Support single item (regardless of selection) drag and drop reordering in GridList #7449

Open patrickdevivo opened 3 days ago

patrickdevivo commented 3 days ago

Provide a general summary of the feature here

I've been following the instructions for a re-orderable GridList with drag and drop here: https://react-spectrum.adobe.com/react-aria/GridList.html#reorderable

However, it took me a while to realize that the drag+drop reordering behavior expects a set of selected items to be reordered. As in, it moves all the selected items, not just the item "grabbed" to be dragged.

I'm not sure if it makes sense generally, but it would be very helpful to my use case if there were a mode/setting/approach that only reordered the single item picked up by the drag event, not the whole selection.

I'm attempting to build a UI for controlling the visibility state and order state of columns in a data table: image

The GridList selection state controls the column visibility, and I'd like to decouple that from the draggable items, so the user can reorder columns one at a time.

πŸ€” Expected Behavior?

Could it be possible to decouple the selected items from the drag behavior? So when dragging items, instead of moving the entire selection set, only moving the item that was "picked up"? Maybe this could be an additional mode or a setting?

😯 Current Behavior

Currently, the reordering/dragging moves the entire selection set, not just the single item that was "picked up"

πŸ’ Possible Solution

No response

πŸ”¦ Context

(see above)

πŸ’» Examples

No response

🧒 Your Company/Team

No response

πŸ•· Tracking Issue

No response