Gathering detailed insights and metrics for react-axe
Gathering detailed insights and metrics for react-axe
Gathering detailed insights and metrics for react-axe
Gathering detailed insights and metrics for react-axe
@axe-core/react
Dynamic accessibility analysis for React using axe-core
axe-prop-types
Same as React PropTypes, but allows you to read/extract inputted values during runtime (useful for automating component documentation).
@public-ui/react
React framework adapter for KoliBri - The accessible HTML-Standard.
axe-react
axe using in react-native
[DEPRECATED] Accessibility auditing for React.js applications
npm install react-axe
Typescript
Module System
Node Version
NPM Version
95.4
Supply Chain
99
Quality
80.6
Maintenance
100
Vulnerability
80.6
License
TypeScript (60.52%)
JavaScript (28.49%)
Shell (5.45%)
CSS (3.41%)
HTML (2.13%)
Total Downloads
16,118,413
Last Day
7,873
Last Week
34,292
Last Month
147,256
Last Year
1,357,401
NOASSERTION License
1,154 Stars
209 Commits
45 Forks
20 Watchers
49 Branches
24 Contributors
Updated on Mar 25, 2025
Minified
Minified + Gzipped
Latest Version
3.5.4
Package Id
react-axe@3.5.4
Unpacked Size
37.57 kB
Size
10.93 kB
File Count
10
NPM Version
6.14.8
Node Version
10.22.0
Cumulative downloads
Total Downloads
Last Day
1.8%
7,873
Compared to previous day
Last Week
-7.6%
34,292
Compared to previous week
Last Month
13.4%
147,256
Compared to previous month
Last Year
-11.4%
1,357,401
Compared to previous year
2
21
This repository has been deprecated. The package has been moved to axe-core-npm. The package will be available via NPM as
@axe-core/react
.
Test your React application with the axe-core accessibility testing library. Results will show in the Chrome DevTools console.
Install the module from NPM or elsewhere
1npm install --save-dev react-axe
Call the exported function passing in the React and ReactDOM objects as well as a timing delay in milliseconds that will be observed between each component change and the time the analysis starts.
1var React = require('react'); 2var ReactDOM = require('react-dom'); 3 4if (process.env.NODE_ENV !== 'production') { 5 var axe = require('react-axe'); 6 axe(React, ReactDOM, 1000); 7}
Be sure to only run the module in your development environment (as shown in the code above) or else your application will use more resources than necessary when in production. You can use envify to do this as is shown in the example.
Once initialized, the module will output accessibility defect information to the Chrome Devtools console every time a component updates.
react-axe will deduplicate violations using the rule that raised the violation and the CSS selector and the failureSummary of the specific node. This will ensure that each unique issue will only be printed to the console once.
The third argument to the exported function is the number of milliseconds to wait for component updates to cease before performing an analysis of all the changes. The changes will be batched and analyzed from the closest common ancestor of all the components that changed within the batch. This generally leads to the first analysis for a dynamic application, analyzing the entire page (which is what you want), while subsequent updates will only analyze a portion of the page (which is probably also what you want).
With version 3.0.0, react-axe now runs accessibility tests inside of open Shadow DOM. You don't have to do anything special other than run react-axe on an component encapsulated with open Shadow DOM (as opposed to closed). For more information, see the axe-core repo.
There is a fourth optional argument that is a configuration object for axe-core. Read about the object here: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure
1var config = { 2 rules: [ 3 { 4 id: 'skip-link', 5 enabled: true 6 } 7 ] 8}; 9 10axe(React, ReactDOM, 1000, config);
Axe-core's context object can be given as a fifth optional argument to specify which element should (and which should not) be tested. Read more from the Axe-core documentation: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#context-parameter
1var context = { 2 include: [['#preview']] 3}; 4 5axe(React, ReactDOM, 1000, undefined, context);
Run a build in the example directory and start a server to see React-aXe in action in the Chrome Devtools console (opens on localhost:8888):
1npm install 2cd example 3npm install 4npm install -g http-server 5npm start
Install dependencies in the root directory (which also installs them in the example directory) and then run the tests:
npm install
npm test
To debug tests in the Cypress application:
npm run test:debug
react-axe uses advanced console logging features and works best in the Chrome browser, with limited functionality in Safari and Firefox.
I have been asked how this is different from modules like react-a11y which test the jsx.
The main difference is that react-axe tests the accessibility of the rendered DOM. This is important because many accessibility issues exist at the intersection of the DOM and the CSS and unless you have a fully rendered DOM, you will get two sorts of inaccuracies:
If you have nice clean code, number 2 will be negligible but number 1 will always be a concern.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
project is archived
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
41 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More