Skip to content

v6: Wire axe into Storybook for component-level a11y#4257

Closed
trevor-scheer wants to merge 1 commit into
graphiql-6from
trevor/storybook-a11y-addon
Closed

v6: Wire axe into Storybook for component-level a11y#4257
trevor-scheer wants to merge 1 commit into
graphiql-6from
trevor/storybook-a11y-addon

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

Summary

Component-level a11y for v6. @storybook/addon-a11y shows axe results next to each story; @storybook/test-runner + axe-playwright run the same rules headlessly in CI.

a11y-baseline.json pins accepted violations; CI fails on net-new only. The starter isn't empty — Storybook's preview iframe always trips landmark-one-main and page-has-heading-one, so those are pre-recorded.

New .github/workflows/accessibility.yml runs the suite on PRs to graphiql-6.

Run locally

In one terminal:

yarn workspace @graphiql/react storybook

In another:

yarn workspace @graphiql/react test:a11y                          # run the gate
A11Y_UPDATE_BASELINE=1 yarn workspace @graphiql/react test:a11y   # refresh baseline

Refs: #4219

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

⚠️ No Changeset found

Latest commit: 24173de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@trevor-scheer trevor-scheer force-pushed the trevor/storybook-a11y-addon branch from f0c2e51 to 22c0092 Compare May 14, 2026 04:23
`@storybook/addon-a11y` runs axe in the Storybook sidebar so violations
show up during component work. `@storybook/test-runner` + `axe-playwright`
run the same rules headlessly in CI; `a11y-baseline.json` pins accepted
violations so the gate only fails on net-new ones.

Starter baseline isn't empty — Storybook's preview iframe inherently
trips `landmark-one-main` and `page-has-heading-one` on every story.

Refresh: A11Y_UPDATE_BASELINE=1 yarn workspace @graphiql/react test:a11y
@trevor-scheer trevor-scheer force-pushed the trevor/storybook-a11y-addon branch from 22c0092 to 24173de Compare May 14, 2026 04:28
@github-actions
Copy link
Copy Markdown
Contributor

The latest changes of this PR are not available as canary, since there are no linked changesets for this PR.

trevor-scheer added a commit that referenced this pull request May 14, 2026
## Background

#4257 is adding a Storybook a11y CI gate to `@graphiql/react`, currently
via `@storybook/test-runner` + `axe-playwright`. The paved path
Storybook recommends is `@storybook/addon-vitest`, which folds stories
into the existing Vitest suite and avoids a separate workflow file,
test-runner config, and JSON baseline. That addon requires Vitest ≥ 3;
we're on `^2.1.9` workspace-wide, so this upgrade is a prerequisite for
taking the cleaner approach in #4257 rather than landing cruft we'd
immediately want to rip out.

## What this enables

Switching #4257 to:

- `@storybook/addon-vitest` + `@storybook/addon-a11y`
- Browser-mode Vitest project for stories (Playwright Chromium, like the
test-runner uses today)
- Per-story `parameters.a11y.test: 'error' | 'todo' | 'off'` — no JSON
baseline file
- No new workflow, no `.storybook/test-runner.ts`, no
`a11y-baseline.json`, no `@storybook/test-runner` / `axe-playwright`
devDeps

## Changes

Workspace-wide bump to Vitest v4 and its companion peer-deps. A few
mocks needed light fixups for v4's stricter `new` semantics.
@trevor-scheer
Copy link
Copy Markdown
Contributor Author

Closing — redoing with @storybook/addon-vitest now that Vitest v4 has landed (#4260). The test-runner + axe-playwright path was a workaround for the Vitest version constraint.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant