Accessibility is important to the Chan Zuckerberg Initiative (CZI), because we envision a country where every student enters adulthood prepared to rea

Automated Accessibility Testing for React

submited by
Style Pass
2021-05-25 22:00:06

Accessibility is important to the Chan Zuckerberg Initiative (CZI), because we envision a country where every student enters adulthood prepared to reach their full potential. This vision isn’t possible if students or teachers are excluded because of a disability.

To support equity and inclusion, we recently started to test our React components for accessibility. Doing so provides faster feedback to engineers, and helps prevent many accessibility problems from getting to our users.

When writing “normal” unit tests with something like React Testing Library, you provide an example of a component for the test. These are the “units” of unit testing.

We need the same kind of examples to test for accessibility. Component story format is a convenient way to do just that. You can write stories for each component, covering the various states you want to test.

Also, these stories can be used for more than accessibility testing. You can re-use them in unit tests, use them for visual regression testing, and see them in Storybook.

Leave a Comment