adobe / adobe/react-spectrum

Disable entire ListBox without needing to set disabledKeys

Open
#5,837 3 comments 0 reactions 0 assignees View on GitHub
accessibility enhancement help wanted ListBox
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the feature here

Hey folks,

I have a ListBox which is displayed inline (aka not popped out by a trigger) inside a component which can be disabled. I'd like to be able to disable a ListBox component entirely without needing to know ahead of time what the items are within the ListBox. Adding `aria-disabled` would make sense I think too.

### 🤔 Expected Behavior?

`` should disable interaction with all items in the ListBox, and possibly set `aria-disabled` on the ListBox outermost element.

### 😯 Current Behavior

Currently it's not possible to disable a ListBox, you have to provide a `disabledKeys` prop with the `id` of all the items. This is problematic if you don't know what the items are ahead of time, or just error prone if the list is manually created.

### 💁 Possible Solution

_No response_

### 🔦 Context

I have an area of my page which is enabled or disabled based on state, the ListBox is inside an area which should be disabled.

### 💻 Examples

_No response_

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.