This is an example project with some baseline a11y issues to help demonstrate how to effectively use axe DevTools automated testing and Intelligent Guided Testing to prevent 80% of a11y bugs during development.
node
- Node 16 or greater- axe DevTools Extension - Chrome · Edge · Firefox (only automatic testing supported)
With npm
npm install
With yarn
yarn install
The following commands are available:
npm run build
- builds the website to thedist
foldernpm run watch
- watches live code changes and spins up a server
Running npm run watch
will build and spin up a live server at http://localhost:10001
. Changes made in any of the project files will automatically be live reloaded in the running web app.
The code example contained in this app is built in preact, a smaller alternative to React but with the same set of APIs.
src/index.tsx
- Application entry pointsrc/assets/css
- All the styles used by the different sections of the appsrc/assets/images
- All the images used by the different sections of the appsrc/components
- All the various components used by the different sections of the app
This is a fictional site with some accessibility issues for demonstration purposes only. Below are some examples of intentional accessibility issues along with the remediation steps hidden behind a expand/collapse element:
The following accessibility issues should be raised from the axe DevTools extension:
- 2 - Elements should have sufficient color contrast:
color-contrast
- 3 - Elements should not have tabindex greater than zero:
tabindex
How to remediate the above issues
To resolve the color contrast issue, change the value of --accent-alt-color
in src/assets/css/variables.css
to a passing accessible color on a #ffffff
background. Example: from #1998fa
to #055a9e
.
To resolve the tab index issue, remove the tabIndex="1"
attribute on the button
element from src/components/Order.tsx
The following accessibility issues should be raised from each tool:
- 1 - The element's roll is missing or incorrect
- 2 - States/Properties: The element has missing or incorrect states or properties
How to remediate the above issues
To resolve the missing/incorrect role, change the div
element with an onClick
attribute in the AccordianPanel
component from div
to button
in src/components/Faq.tsx
.
To resolve the missing/incorrect state, add aria-expanded={showDescription}
to the same element from before in src/components/Faq.tsx
.
- 1 - Visual heading text is not marked as heading
How to remediate the above issue
To resolve the missing heading, change the "What's Popular" div
element from div
to h2
in src/components/Faq.tsx
.
There should be no accessibility issues raised as any potential issues should be resolved by prior remediation fixes.