fix(a11y): add aria-selected attribute to tab buttons#1
Merged
Conversation
Fixes screen reader announcing incorrect selected state on non-selected tabs. Added aria-selected and tabIndex attributes to TabButton components to properly communicate tab state to assistive technologies like Windows Narrator. Fixes storybookjs#32654
|
Caution Review failedThe pull request is closed. WalkthroughAdded aria-selected to tab buttons in tabs.tsx, setting it based on the active state. No changes to control flow, events, or exports. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes screen reader announcing incorrect selected state on non-selected tabs. Added aria-selected attribute to TabButton components to properly communicate tab state to assistive technologies like Windows Narrator.
Closes storybookjs#32654
What I did
Added
aria-selectedattribute to TabButton components in the Tabs component to fix accessibility issues where screen readers (Windows Narrator) were announcing incorrect "selected" state on non-selected tabs.The fix includes:
aria-selected={active}- Properly communicates selected state to screen readersChecklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Manual testing is required for this accessibility fix.
Testing steps:
yarn startTested on:
Result: ✅ Screen reader now correctly announces selected/not selected state on tabs.
Documentation
MIGRATION.MD
Note: No documentation update needed as this is an internal accessibility fix with no API changes.
Checklist for Maintainers
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsSummary by CodeRabbit