-
Notifications
You must be signed in to change notification settings - Fork 645
Fix missing selection attributes in ActionList items #4096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: dc1ea48 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
| > | ||
| <li | ||
| aria-labelledby="0--label " | ||
| aria-selected={false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Autocomplete might have had a similar issue with list items not having aria-selected attributes, and this fix applies here as well.
Addresses the following a11y audit issue: https://github.com/github/accessibility-audits/issues/4484 (GitHub staff only)
This PR fixes an accessibility issue with
ActionListitems not reporting their selection state to screen readers.The
aria-selected(oraria-checked) attributes were not being applied toActionList.Itembecause they were only being read fromActionListContainerContext, butActionListinstances don't provide that context.The solution I chose here was to automatically infer the selection attribute type based on the item's role:
menuitemcheckboxandmenuitemradioroles get an inferred selection attribute ofaria-checked, whileoptionroles will getaria-selected.Of course, if a selection attribute is specified through
ActionListContainerContext, that will be preferred.Interestingly, selection state was asserted in one of the component tests, but the
aria-selectedattribute was manually provided in the test stub. Removing that allows the test to assert the actual selection behavior.Demo
This screenshot demonstrates the NVDA screenreader properly announcing the selection state with this change:
Rollout strategy
Testing & Reviewing
Merge checklist