react-uswds icon indicating copy to clipboard operation
react-uswds copied to clipboard

[feat] Automated accessibility check to our development pipeline.

Open AnnaGingle opened this issue 1 year ago • 5 comments

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.

  • As government websites are required to meet section 508 compliance accessibility should be a north star rather than an afterthought.
  • Adding this check into the pipeline can help remediate one of the challenges when working on accessibility issues - finding out if the problem is tied to your configuration or the library

Describe the solution you'd like

  • Add an automated accessibility check to our development pipeline, specially section 508 / WCAG 2.0.
  • Continuous Integration tests incorporate accessibility tools like axe and errors block commits.
  • An automated process set up to optimize the use of developer time.

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

  • Deque's aXe has changed the playing field for site reviews. Because of its flexible design, it can be executed from the command line, from within the browser, or even from a WYSIWYG editor. Being executed from the command line means that it is much easier to simply add accessibility checking to any scripts that are being run. It can be appended to a script crawling to ensure security best practices are maintained, or simply added to a continuous integration script.
  • Pa11y-ci is a continuous integration (CI) runner that can test a few pages or an entire site for accessibility issues.
  • Cypress is a JavaScript testing framework that is used for automated testing. Axe core is a popular accessibility testing engine.
  • Jest-axe / Testing with Jest on GitHub
  • Nightwatch aXe-core / Testing with Nightwatch on GitHub

Additional context

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

AnnaGingle avatar Apr 05 '24 14:04 AnnaGingle

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.

werdnanoslen avatar Apr 08 '24 19:04 werdnanoslen

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 avatar Apr 17 '24 23:04 kimallen

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?

kimallen avatar Apr 17 '24 23:04 kimallen

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)

werdnanoslen avatar Apr 25 '24 13:04 werdnanoslen

Recommendation from @JasonLin0991: https://www.deque.com/axe/core-documentation/api-documentation/

kimallen avatar Sep 30 '24 15:09 kimallen