---
url: "https://web.dev/articles/accessibility-auditing-react"
titulek: "Accessibility audit with react-axe and eslint-plugin-jsx-a11y | Articles | web.dev"
h1: "Accessibility audit with react-axe and eslint-plugin-jsx-a11y Stay organized with collections Save and categorize content based on your preferences."
popis: "react-axe is a library that audits a React application and logs any accessibility issues to the Chrome DevTools console. eslint-plugin-jsx-a11y is an ESLint plugin that identifies and enforces a number of accessibility rules directly in your JSX. Using them in combination can provide a comprehensive auditing approach to find and fix any accessibility concerns in your application."
jazyk: "en"
kanonicka: "https://web.dev/articles/accessibility-auditing-react"
drobecky: ["Articles", "Accessibility audit with react-axe and eslint-plugin-jsx-a11y"]
zdroj: "live"
wayback_snapshot: ""
stazeno: "2026-09-14 00:05:12"
znaku: 4730
slov: 669
kodovani: "iso-8859-2"
sha256: "15d608ba6c49b46eade100eb03bdea146bb9c6835aaf6d0cf9dcb20668220528"
---
Accessibility audit with react-axe and eslint-plugin-jsx-a11y
Stay organized with collections
Save and categorize content based on your preferences.
Houssein Djirdeh
Your React site must be accessible to be progressive. Audit for accessibility
during development to find and address any issues before you push your
application into production. [`react-axe`](https://github.com/dequelabs/react-axe) is a library that audits a
React application and logs any accessibility issues to the Chrome DevTools
console. It uses the open-source [axe](https://github.com/dequelabs/axe-core)
testing library to flag any issues and their severity. [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y) is
an ESLint plugin that identifies and enforces a number of accessibility rules
directly in your JSX. When used in combination with a tool that tests the final
rendered DOM, such as `react-axe`, you can find and fix any accessibility
concerns on your site. Why is this useful? It's crucial to build websites that are accessible to all users, including those
with disabilities. By using an accessibility audit library, such as
`react-axe` and `eslint-plugin-jsx-a11y`, you can find accessibility issues as
you build your application, so you can fix them before going to production. Use eslint-plugin-jsx-a11y React already supports writing accessible HTML elements within JSX syntax. For
example, use the `htmlFor` attribute instead of `for` to add a label to a
form element within a React component. `
` The
[React accessibility documentation](https://reactjs.org/docs/accessibility.html)
covers the nuances of handling accessibility concerns within a React
component. To more easily spot these issues, Create React App (CRA) includes
the `eslint-plugin-jsx-a11y` plugin. To enable pre-configured linting provided by CRA: Install the [ESLint plugin](https://eslint.org/docs/user-guide/integrations#editors)
for your code editor. Add a `.eslintrc.json` file to your project `{ "extends": "react-app" }` Once configured, common accessibility issues can be found. To check for more accessibility rules, modify `.eslintrc.json` to include all of
the plugin's recommended rules: `{ "extends": ["react-app", "plugin:jsx-a11y/recommended"] }` For an even stricter subset of rules, switch to strict mode: `{ "extends": ["react-app", "plugin:jsx-a11y/strict"] }` The project
[documentation](https://github.com/evcohen/eslint-plugin-jsx-a11y#difference-between-recommended-and-strict-mode)
provides information on the differences between recommended and strict mode. Use react-axe `eslint-plugin-jsx-a11y` can help you find any accessibility issues in your JSX,
but it does not test any of the final HTML output. The `react-axe` library
conducts testing by adding a React wrapper around the
[`axe-core`](https://github.com/dequelabs/axe-core) testing tool by Deque Labs. Install the library as a development dependency:
`bash
npm install --save-dev react-axe` Initialize the module in `index.js`:
`js
if (process.env.NODE_ENV !== 'production') {
import('react-axe').then(axe => {
axe.default(React, ReactDOM, 1000);
ReactDOM.render(, document.getElementById('root'));
});
} else {
ReactDOM.render(, document.getElementById('root'));
}` A [dynamic import](https://v8.dev/features/dynamic-import) loads the library,
as long as it's not in production, before rendering and booting up the root
`App` component. This ensures that the it's not included in the final
production bundle if it's unnecessary. When you run the application during development, issues are surfaced
directly to the Chrome DevTools console. A severity level is also assigned for each violation. These levels are: Minor Moderate Serious Critical Conclusion Include accessibility audits early in your workflow to catch problems as you
build your React applications.Use `eslint-plugin-jsx-a11y` to add accessibility
checks into your linting workflow. CRA already includes it, but you can switch
to either the recommended or strict mode. In addition to local development testing, include `react-axe` in your
application to catch any issues on the final rendered DOM. Don't include it
into your production bundle. Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2019-04-29 UTC.