downshift-js / downshift

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
http://downshift-js.com/
MIT License
12.09k stars 931 forks source link

Reordering items by drag&drop #1461

Closed rodbs closed 1 year ago

rodbs commented 1 year ago

Is it possible to reorder items in the multiselect using drag and drop as in react-select? I haven't seen this feature anywhere.

Is there any easy workaround to implement it? or would it need to be fully implemented in the code (using a library like floating-ui?

silviuaavram commented 1 year ago

Reordering them via DnD is totally up to you. Just make sure to update the order of the selectedItems via the prop passed to useMultipleSelection.

rodbs commented 1 year ago

Ok, I'm using @dnd-kit and it seems to work; I'm having some issues with the events, though ...

silviuaavram commented 1 year ago

make sure to call the getter props like this:

getSelectedItemProps({onKeyDown: theOtherPossibleKeyDown, ...})

Will close this one. If there is a possible issue in downshift let us know. Thanks!