Manager: Remove deprecated active prop warning in ZoomButton#33697
Conversation
Migrates ZoomButton from Button with deprecated active prop to ToggleButton with pressed prop, removing the console warning that appears on fresh Storybook installs. Fixes storybookjs#33689
📝 WalkthroughWalkthroughSwaps Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes ✨ Finishing touches
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
code/core/src/manager/components/preview/tools/zoom.tsx (1)
147-154: SetariaLabel={false}since the button has text content.The
pressedprop migration is correct, but theariaLabelprop doesn't follow codebase conventions. Buttons with text content should setariaLabel={false}to indicate that the button's accessible name is derived from its content (the percentage). TheariaLabel="Change zoom level"string should be removed.Code change needed:
<ZoomButton padding="small" variant="ghost" ariaLabel={false} pressed={value !== INITIAL_ZOOM_LEVEL} > {Math.round(value * 100)}% </ZoomButton>
|
Hi @yatishgoel Thank you for your contribution! Could you please fix the failing test cases and fix the linting errors? |
|
The failure in ci/circleci: vue-v3--vite---typescript---dev is a flake. You can ignore it. |
active prop warning in ZoomButtonactive prop warning in ZoomButton
…e-prop Manager: Remove deprecated `active` prop warning in ZoomButton (cherry picked from commit faab923)
Closes #33689
What I did
Replaced the deprecated
activeprop onButtonwithToggleButtonusing thepressedprop in the Zoom toolcomponent.
Changes:
ButtontoToggleButtonZoomButtonstyled component to extendToggleButtoninstead ofButtonactive={value !== INITIAL_ZOOM_LEVEL}withpressed={value !== INITIAL_ZOOM_LEVEL}This removes the deprecation warning that appears in the browser console on fresh Storybook installs:
The active prop on Button is deprecated and will be removed in Storybook 11. Use specialized components like
ToggleButton or Select instead.
Checklist for Contributors
Testing
yarn task --task sandbox --start-from auto --template react-vite/default-tsThe changes in this PR are covered in the following automated tests:
Manual testing
yarn task --task sandbox --start-from auto --template react-vite/default-tsDocumentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
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.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.