trussworks / react-uswds

USWDS 3.0 components built in React
https://trussworks.github.io/react-uswds/
Apache License 2.0
169 stars 78 forks source link

[feat] Automated accessibility check to our development pipeline. #2869

Open AnnaGingle opened 3 months ago

AnnaGingle commented 3 months ago

Does your feature request relate to a specific USWDS component?

No

What USWDS Version is this feature present in?

Any.

Is your feature request related to a problem? Please describe.

We should add an automated accessibility check to our development pipeline.

Describe the solution you'd like

Describe alternatives you've considered

On a previous project we used Jest-axe (app testing) Storybook a11y add on (component level testing). @gidjin, @abbyoung, or @jcbcapps may be able to shed more light on that.

Well-known solutions to consider

Additional context

Most of this information is from the CivicAction accessibility site. They put together some really impressive documentation on this topic.

werdnanoslen commented 3 months ago

Noting that I looked into adding Playwright, but that would only be useful locally (not as a GH-run action). We could have it run locally on commit, but I think we'd rather have it run on the repo as well to ensure no a11y bugs creep in.

kimallen commented 3 months ago

We already use @storybook/addon-a11y in development. @AnnaGingle are you recommending that we include it in the production version of storybook so that users looking at the deployed storybook instance can see the a11y scan results?

kimallen commented 3 months ago

We do use a linter, eslint-plugin-jsx-a11y in the development process. And the description suggests using Cypress/axe, though I only know of Cypress' use as an integration test tool. Since react-uswds is a library of components, @AnnaGingle how do you see Cypress being utilized in this case?

werdnanoslen commented 2 months ago

Ah, didn't realize Cypress was integration only — I imagined this feature would either run similar to the other Vitest/Jest unit tests (e.g. expect(component).toBeAccessible) or run on more complex stories without needing to be run locally (see my Playwright experiment)