-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A11y Addon: Adjust default behaviour when using with experimental-addon-test #30162
base: next
Are you sure you want to change the base?
Conversation
…y checkbox if a11ytest tag is set on at least one story
View your CI Pipeline Execution ↗ for commit 9d614f5.
☁️ Nx Cloud last updated this comment at |
code/lib/cli-storybook/src/automigrate/fixes/__snapshots__/addon-a11y-addon-test.test.ts.snap
Outdated
Show resolved
Hide resolved
… setup and preview files
…ging for a11y addon setup
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
…g addon migration
Failed to publish canary version of this pull request, triggered by @valentinpalkovic. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/12581235232 |
…nfiguration handling
… in the preview file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor suggestions, but overall looks good. (Haven't tried it out)
PS. For changes like these, I'd love just a screenshot of the terminal output in the future, so I can quickly see what the result looks like ❤️
const [currentConfig, setConfig] = useState<Config>(() => { | ||
updateTestProviderState(initialConfig); | ||
return initialConfig; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty wild way to ensure updateTestProviderState(initialConfig)
only runs on first render. Feels like a useEffect
with an empty array is more explicit.
React docs says this:
If you pass a function as initialState, it will be treated as an initializer function. It should be pure, should take no arguments, and should return a value of any type.
But this is not pure, it has a side-effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I experimented with this part of the code a lot. I used useEffect
initially with an empty array, but the outcome was not the same. Let me try it once again, though!
Closes #
What I did
addon-a11y
installer / automigration to add commented/* 'a11y-test ' */
tag to preview.js, with a comment explaining what it can do for youaddon-a11y
and to be checked by default (if at least one story has a11y-test tag set?)Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH 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.ts
Make 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 pull request has been released as version
0.0.0-pr-30162-sha-fc2610f4
. Try it out in a new sandbox by runningnpx [email protected] sandbox
or in an existing project withnpx [email protected] upgrade
.More information
0.0.0-pr-30162-sha-fc2610f4
valentin/a11y-refactorings
fc2610f4
1736431994
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=30162
Greptile Summary
Based on the provided files and PR information, here's a concise summary of the key changes:
Modifies the behavior of the Storybook a11y addon to make accessibility testing more explicit and configurable when used with the experimental test addon.
The changes make accessibility testing more intentional while maintaining backward compatibility through automated migration tools.