Announce SegmentedControl selected state with aria-pressed#8196
Announce SegmentedControl selected state with aria-pressed#8196liuliu-dev wants to merge 2 commits into
SegmentedControl selected state with aria-pressed#8196Conversation
🦋 Changeset detectedLatest commit: 65a0b63 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 |
|
|
Integration test results from github/github-ui PR:
All checks passed! |
There was a problem hiding this comment.
Pull request overview
This PR improves SegmentedControl accessibility by switching the selected-state announcement from aria-current to aria-pressed, aligning the component’s semantics with screen reader expectations (notably JAWS) so activation produces audible feedback.
Changes:
- Replace
aria-currentwitharia-pressedonSegmentedControl.ButtonandSegmentedControl.IconButton. - Update CSS selectors and unit tests to target
aria-pressed. - Add a changeset for a patch release documenting the accessibility improvement.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/SegmentedControl/SegmentedControlIconButton.tsx | Use aria-pressed to expose icon-segment selected state to AT. |
| packages/react/src/SegmentedControl/SegmentedControlButton.tsx | Use aria-pressed to expose text-segment selected state to AT. |
| packages/react/src/SegmentedControl/SegmentedControl.test.tsx | Update assertions to validate aria-pressed state. |
| packages/react/src/SegmentedControl/SegmentedControl.module.css | Update styling selectors to key off aria-pressed instead of aria-current. |
| .changeset/segmented-control-aria-pressed.md | Patch changeset documenting the a11y behavior change. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Low
related issue github/accessibility-audits#16804.
Note: needs https://github.com/github/github-ui/pull/27315 merged to pass integration tests
Changelog
Changed
SegmentedControl.ButtonandSegmentedControl.IconButtonusedaria-currentto signal the selected segment. JAWS doesn't treataria-currentas a button state, so activating a segment produced no audible feedback, fails WCAG 4.1.2. Switching toaria-pressed(the toggle-button state) fixes the announcement. CSS selectors and tests are updated to match.Rollout strategy
Testing & Reviewing