fix: add ariaLabel support to ActionItem interface#34752
Conversation
Fixes #34746 Problem: The ActionItem interface used by canvas.additionalActions in the docs addon doesn't include an ariaLabel property. Storybook 11 will require ariaLabel on Button components, causing console warnings when users add custom actions via additionalActions with no way to provide ariaLabel. Solution: - Added ariaLabel?: string | false to ActionItem interface - Updated ActionBar component to pass ariaLabel to button elements - Added ariaLabel to additionalActions type in docs addon - ariaLabel=false allows opt-out for buttons with text content Changes: - code/core/src/components/components/ActionBar/ActionBar.tsx - Added ariaLabel property to ActionItem interface - Updated ActionBar to destructure and pass ariaLabel to buttons - code/addons/docs/src/types.ts - Added ariaLabel property to additionalActions type This allows users to provide meaningful aria-label values for accessibility or set ariaLabel={false} for buttons with text content.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds optional ChangesAria-label Support for Action Items
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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 |
|
Hi @xxiaoxiong! Thank you so much for your PR to Storybook! ❤️ Unfortunately, someone else wrote a PR for the same issue just before you, and I've just merged that other PR. So I'm gonna have to close yours 😞 Feel free to pick up another issue without any PR if you're still keen to contribute to Storybook! Thanks |
What I did
Added
ariaLabelsupport to theActionIteminterface to resolve accessibility warnings when usingcanvas.additionalActionsin the docs addon.How to test
additionalActionsin.storybook/preview.tsx:ariaLabelariaLabel: falseto opt outChecklist for Contributors
Testing
yarn task sandboxin AGENTS.md)Documentation
Versioning
Issue
Fixes #34746
Problem
The
ActionIteminterface used bycanvas.additionalActionsin the docs addon doesn't include anariaLabelproperty. Storybook 11 will requireariaLabelon Button components, causing console warnings:Users had no way to provide
ariaLabelbecause theActionItemtype doesn't accept it.Solution
ariaLabel?: string | falsetoActionIteminterfaceActionBarcomponent to passariaLabelto button elementsariaLabeltoadditionalActionstype in docs addonariaLabel={false}allows opt-out for buttons with text content (matching Button component behavior)Changes
Modified files:
code/core/src/components/components/ActionBar/ActionBar.tsxariaLabelproperty toActionIteminterfaceActionBarto destructure and passariaLabelto buttonscode/addons/docs/src/types.tsariaLabelproperty toadditionalActionstypeImpact
Users can now:
aria-labelvalues for accessibilityariaLabel={false}for buttons with text content to suppress warningsariaLabelrequirementSummary by CodeRabbit
false.