Skip to content
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

Open
wants to merge 26 commits into
base: next
Choose a base branch
from

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Jan 2, 2025

Closes #

What I did

  • Update addon-a11y to not add a11y-test tag implicitly
  • Update addon-a11y installer / automigration to add commented /* 'a11y-test ' */ tag to preview.js, with a comment explaining what it can do for you
  • Update the checkbox behavior for addon-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:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/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 running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-30162-sha-fc2610f4
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/a11y-refactorings
Commit fc2610f4
Datetime Thu Jan 9 14:13:14 UTC 2025 (1736431994)
Workflow run 12691645189

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.8 MB 77.8 MB 0 B -2.12 0%
initSize 131 MB 131 MB 0 B -0.34 0%
diffSize 53 MB 53 MB 0 B -0.33 0%
buildSize 7.19 MB 7.19 MB 1 B 1.1 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B -0.82 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 0 B -0.82 0%
buildPreviewSize 3.28 MB 3.28 MB 1 B 1.1 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 11.8s 26.7s 14.9s 1.49 🔺55.7%
generateTime 22.5s 23.3s 780ms 2.14 3.3%
initTime 15.1s 15.6s 525ms 1.67 3.4%
buildTime 8.2s 11.1s 2.8s 1.51 🔺25.7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.2s 4.5s -731ms -1.08 -16.1%
devManagerResponsive 3.9s 3.5s -455ms -0.72 -13%
devManagerHeaderVisible 586ms 582ms -4ms -0.71 -0.7%
devManagerIndexVisible 613ms 663ms 50ms -0.06 7.5%
devStoryVisibleUncached 2.1s 914ms -1s -275ms -2.75 🔰-139.5%
devStoryVisible 614ms 664ms 50ms -0.1 7.5%
devAutodocsVisible 549ms 507ms -42ms -0.66 -8.3%
devMDXVisible 490ms 493ms 3ms -0.87 0.6%
buildManagerHeaderVisible 530ms 562ms 32ms -0.59 5.7%
buildManagerIndexVisible 621ms 668ms 47ms -0.44 7%
buildStoryVisible 519ms 551ms 32ms -0.53 5.8%
buildAutodocsVisible 415ms 491ms 76ms -0.12 15.5%
buildMDXVisible 407ms 451ms 44ms -0.52 9.8%

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.

  • Changed accessibility test tag from 'a11ytest' to 'a11y-test' for better naming consistency
  • Removed implicit addition of a11y-test tag, making it opt-in through preview configuration
  • Added automigration to help users configure a11y testing with commented tags and proper documentation
  • Updated checkbox behavior to be checked by default when any story has the 'a11y-test' tag
  • Modified test runner to only execute a11y tests when explicitly enabled in Storybook environment

The changes make accessibility testing more intentional while maintaining backward compatibility through automated migration tools.

Copy link

nx-cloud bot commented Jan 2, 2025

View your CI Pipeline Execution ↗ for commit 9d614f5.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 36s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-10 10:14:24 UTC

@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Jan 2, 2025

Package Benchmarks

Commit: 9d614f5, ran on 10 January 2025 at 10:21:15 UTC

No significant changes detected, all good. 👏

@storybook-bot
Copy link
Contributor

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

@valentinpalkovic valentinpalkovic marked this pull request as ready for review January 9, 2025 14:58
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Copy link
Contributor

@JReinhold JReinhold left a 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 ❤️

code/addons/test/src/components/TestProviderRender.tsx Outdated Show resolved Hide resolved
Comment on lines +463 to +466
const [currentConfig, setConfig] = useState<Config>(() => {
updateTestProviderState(initialConfig);
return initialConfig;
});
Copy link
Contributor

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.

Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants