react-spectrum
react-spectrum copied to clipboard
ListBox: Backspace/Delete
I want to delete/remove items from a ListBox using keyboard events
I would like to use a ListBox for selection. In addition to onAction(), I need onDelete() or something low-level, such as, onKeyDown() to handle deletion of items.
Currently, neither ListBox nor ListBoxItem allow custom keyboard event handling. I could register a global listener, but: I then need to implement the follow-up selection logic.
I believe this behaviour should be baked into the component. Think about a email inbox in Apple Mail. Or⦠is there another component that support this interaction?
π€ Expected Behavior?
Press backspace/delete on selected items fires and event / callback.
π― Current Behavior
Currently, neither ListBox nor ListBoxItem allow custom keyboard event handling. I could register a global listener, but: I then need to implement the follow-up selection logic.
π Possible Solution
In addition to onAction(), I need onDelete() or something low-level, such as, onKeyDown() to handle deletion of items.
π¦ Context
Think about a email inbox in Apple Mail. You can select items, press backspace/delete to remove selected items.
π» Examples
No response
π§’ Your Company/Team
No response
π· Tracking Issue
No response