fix: add ariaLabel to ActionItem interface#34761
Conversation
Core: Prevent story-local viewport from persisting in URL (cherry picked from commit b00ebfa)
CLI: Use npm info to fetch versions in repro command (cherry picked from commit ac8171e)
Build: Update `test-runner` to use a single jest-worker (cherry picked from commit 2f5025f)
Release: Patch 10.3.1
React Native Web: Fix vite8 support by bumping vite-plugin-rnw (cherry picked from commit ddc9320)
CLI: Shorten CTA link messages (cherry picked from commit ed6fb10)
CI: Relax Danger label rules on release PRs (cherry picked from commit 793e354)
Release: Patch 10.3.2
Update CHANGELOG to remove experimental tool entry (cherry picked from commit 25a4b10)
…-validation-detection-across-init-and-postinstall Addon-Vitest: Streamline vite(st) config detection across init and postinstall (cherry picked from commit b2fb7d8)
Release: Patch 10.3.3
…eration Build: Retry-mechanism for dts bundle-generation (cherry picked from commit 7801015)
Core: Fix WebSocket connection for StackBlitz/WebContainers (cherry picked from commit a5658d3)
…llision Builder-Vite: Use djb2 hash to prevent variable name collisions in builder-vite (cherry picked from commit 1c38a36)
…ut-on-unmount Addon-a11y: Clear status transition timer on unmount to prevent test flake (cherry picked from commit febea63)
…ocgen-typescript-0.7.0 React-Vite: Upgrade @joshwooding/vite-plugin-react-docgen-typescript to 0.7.0 (cherry picked from commit 544d8c9)
…-init CLI: Prompt for init crash reports (cherry picked from commit 8d12309)
Docs: Add troubleshooting for react-docgen-typescript in monorepos (cherry picked from commit 0efef13)
…back React-Docgen: Try .tsx fallback when resolving .js ESM imports in docgen resolvers (cherry picked from commit 069e745)
(cherry picked from commit 15edac0)
Docs: Add AI contributions guide in contributing.md and documentation (cherry picked from commit 7022915)
UI: Fix global background + color styles affecting stories (cherry picked from commit b9549a6)
…torybook-test ESLint: Update deprecated @storybook/test reference to storybook/test (cherry picked from commit 77ff820)
Fix: Add vite-plus vendored libraries version detection (cherry picked from commit 316df07)
Build: Remove vite-plus as devDependency (cherry picked from commit e8dfd05)
Release: Patch 10.3.6
The ActionItem interface used by canvas.additionalActions in the docs addon does not include an ariaLabel property. Storybook 11 will require ariaLabel on Button components. - Add optional ariaLabel?: string to ActionItem interface - Pass ariaLabel through to Button in Preview component Fixes #34746
📝 WalkthroughWalkthroughThe PR adds accessibility and story reload enhancements to the Preview and ActionBar components. An optional ChangesPreview Reload and Action Accessibility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/core/src/components/components/ActionBar/ActionBar.tsx`:
- Line 77: ActionItem.ariaLabel was added to the type but never forwarded when
ActionBar renders ActionButton, so the accessible label is dropped; update the
mapping in the ActionBar component where it renders ActionButton (look for the
render of ActionButton inside ActionBar and the function handling items) to pass
item.ariaLabel (or ariaLabel) through to the ActionButton props (e.g.,
aria-label={item.ariaLabel}) and ensure the ActionButton component
accepts/forwards that prop so consumers can set the accessible label.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e04997b2-6bec-4208-94d8-1af43e0c9917
📒 Files selected for processing (2)
code/addons/docs/src/blocks/components/Preview.tsxcode/core/src/components/components/ActionBar/ActionBar.tsx
| className?: string; | ||
| onClick: (e: MouseEvent<HTMLButtonElement>) => void; | ||
| disabled?: boolean; | ||
| ariaLabel?: string; |
There was a problem hiding this comment.
ActionItem.ariaLabel is declared but never applied in ActionBar.
The new field is added to the type, but ActionBar still drops it when rendering ActionButton, so consumers cannot actually set an accessible label there.
Suggested fix
- {actionItems.map(({ title, className, onClick, disabled }, index: number) => (
- <ActionButton key={index} className={className} onClick={onClick} disabled={!!disabled}>
+ {actionItems.map(({ title, className, onClick, disabled, ariaLabel }, index: number) => (
+ <ActionButton
+ key={index}
+ className={className}
+ onClick={onClick}
+ disabled={!!disabled}
+ aria-label={ariaLabel}
+ >
{title}
</ActionButton>
))}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@code/core/src/components/components/ActionBar/ActionBar.tsx` at line 77,
ActionItem.ariaLabel was added to the type but never forwarded when ActionBar
renders ActionButton, so the accessible label is dropped; update the mapping in
the ActionBar component where it renders ActionButton (look for the render of
ActionButton inside ActionBar and the function handling items) to pass
item.ariaLabel (or ariaLabel) through to the ActionButton props (e.g.,
aria-label={item.ariaLabel}) and ensure the ActionButton component
accepts/forwards that prop so consumers can set the accessible label.
The previous map pointed every entry at claude-opus-4-5-20250929, which returns 404 from the Anthropic API. Update to current public IDs: - claude-opus-4-7[1m] / claude-opus-4-7 → claude-opus-4-7 - claude-opus-4-6 → claude-opus-4-6 - claude-opus-4-5 → claude-opus-4-5-20251101 (correct snapshot) Update MODEL_MAX_TOKENS keys to match. Verified live AC-V4-1 (spec written) and AC-V4-3b (cache_read_input_tokens=4358 >= 1024) against PR #34761. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hi @algojogacor, Due to a recent high volume of unreviewed AI-generated PRs, we are requesting verification and proof that the implemented fix actually works. Please provide a simple GIF/Video or image of how the fix works, optimally with before-and-after comparisons. Thank you for your understanding! |
|
Hi @algojogacor Thank you for your contribution. Our base branch is |
Summary
Fixes #34746
The
ActionIteminterface used bycanvas.additionalActionsin the docs addon does not include anariaLabelproperty. Storybook 11 will requireariaLabelon Button components, and users cannot currently provide it for custom additional actions.Root Cause
The
ActionIteminterface atcode/core/src/components/components/ActionBar/ActionBar.tsx:68-72defines the shape for additional action items but lacks anariaLabelproperty. InPreview.tsx, the action items are rendered as<Button>components without anyariaLabelprop being passed through.When a user adds custom actions via
additionalActionsin their preview configuration, Storybook 10.x emits a console warning thatariaLabelwill become mandatory in Storybook 11, but there is no way to provide it through the public API.Fix
ariaLabel?: stringto theActionIteminterface inActionBar.tsxariaLabelin theadditionalActionItems.map()callback inPreview.tsxariaLabel={ariaLabel}to the<Button>componentWhen
ariaLabelis not provided (undefined), the Button component treats it as if the prop was not passed, maintaining backward compatibility.Changes
code/core/src/components/components/ActionBar/ActionBar.tsx: +1 line (addedariaLabel?: stringtoActionIteminterface)code/addons/docs/src/blocks/components/Preview.tsx: +2 lines (destructuredariaLabel, passed to Button)Testing
ariaLabel: no change in behavior, existing warning still fires ✅ariaLabel: "View on GitHub":ariaLabelpassed through to Button, warning suppressed ✅ariaLabelpresence: each action independently receives its ownariaLabel✅ActionItemacceptsariaLabelwithout type errors ✅Summary by CodeRabbit