Repository navigation
feat: Add a11y test tooling, LiveRegion and span support for VisuallyHidden - #2615
bprusinowski wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mburri
left a comment
There was a problem hiding this comment.
Thanks for the setup.
See my comment on the asymetric WCAG coverage in tests.
| runOnly: { type: "tag", values: WCAG_TAGS }, | ||
| rules: { | ||
| "color-contrast": { enabled: false }, | ||
| }, |
There was a problem hiding this comment.
Why is the color contrast rule disabled?
It is not disbled in e2e/a11y.ts - so e2e and axe tests may differ. Is this intentional?
There was a problem hiding this comment.
Thanks for taking a look @mburri!
Yes, it's intentional – in jsdom, axe's color-contrast rule can't produce a result: it measures colors on a canvas (HTMLCanvasElement.getContext), which jsdom doesn't implement. I ran the unit axe specs with the rule enabled: 0 violations, every text node either errored into "incomplete" or wasn't checked at all, and even #ddd on white (1.6:1) wasn’t flagged.
Contrast is checked in e2e tests in a real browser, I've added a comment to explain 👍
Part of the GitLab a11y audit Prepares the fixes in the following PRs.
This PR adds:
expectNoAxeViolationshelpers for vitest and Playwright (axe-core, WCAG 2.1 A/AA)LiveRegion, a debounced polite status region for screen reader announcementscomponent="span"support inVisuallyHidden, for use inside buttonsHow to test
yarn test live-region visually-hidden.