Add automated a11y testing #361
Labels
infrastructure
CATEGORY: Infrastructure related - e.g. updates to build process, tests, tooling, etc.
🌟 enhancement
TYPE: Indicates new feature requests
Is your feature request related to a problem? Please describe.
We should add some a11y testing to our UI components (after all, Inclusive is one of Gravity's principles!).
Such tests could flag common pitfalls like:
alt
attributes on images<label>
elements and their associated inputsaria-*
attributesThis should help us ensure that our UI components individually are designed and built correctly and won't prevent downstream consumers from assembling accessible UIs from them.
Describe the solution you'd like
packages./gravity-ui-nunjucks/
and have the tools access the per-component pages that Fractal already generates for us. Note though that we want to specifically test our component HTML, not Fractal's pattern library UI. The "preview" pages it creates (e.g. http://localhost:3000/components/preview/superseded ) look appropriate. So, if we could get our chosen tool to iterate over all the preview pages, that would be ideal.package.json
to make it easy to run the tests. Perhapstest:a11y
, so we can invoke them by doingnpm run test:a11y
.test
script, which for now would just run the a11y tests. In time, if we add other kinds of tests, they can be appended. That waynpm run test
will run all tests, where asnpm run test:a11y
will only run the a11y teststest
script, which callslerna run test
and that in turn will run thetest
script for all sub-packages that have one. Maybe verify this is indeed working as expected and, if not, do whatever's needed to fix it. The CI should be running the a11y tests.README.md
with instructions on how to run the tests.At this point, I'd say the work is done.
If the tests highlight lots of errors (and thus cause CI builds to fail), we may need to temporarily disable the a11y tests on CI builds and raise new Github issues to get the a11y bugs fixed. On the other hand, if there's only a few bugs and they're trivial to fix, then it might be easier to just fix them as part of this work.
The text was updated successfully, but these errors were encountered: