Skip to content

ListBox: Backspace/Delete #8732

@getflourish

Description

@getflourish

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    🩺 To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions