Skip to content

Keyboard shortcut to deselect all items in a selectable collection #4476

@tgelu

Description

@tgelu

🙋 Feature Request

In @react-aria/selection ctrl+a or cmd+a selects all items in a selectable collection. It would be useful if the same key combination would deselect all items if all items are already selected. This is the pattern recommended in the listbox aria patterns:

Control + A (Optional): Selects all options in the list. Optionally, if all options are selected, it may also unselect all options.

🤔 Expected Behavior

ctrl+a and cmd+a do not deselect all items if all items are already selected.

😯 Current Behavior

ctrl+a and cmd+a deselect all options if all options are already selected.

💁 Possible Solution

Seems like a simple change in this file if I am not wrong.

🔦 Context

I built a custom select which allows for multiple selection in the listbox in the dropdown. There, esc is already mapped to closing the dropdown so there is no easy way to deselect all items. This is inconvenient both for keyboard or mouse users.

💻 Examples

N/A

🧢 Your Company/Team

N/A

🎁 Tracking Ticket (optional)

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions