Gathering detailed insights and metrics for axe-core-react-ffit
Gathering detailed insights and metrics for axe-core-react-ffit
npm install axe-core-react-ffit
Typescript
Module System
Node Version
NPM Version
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,515
Last Day
1
Last Week
3
Last Month
20
Last Year
385
Minified
Minified + Gzipped
Latest Version
4.4.4
Package Id
axe-core-react-ffit@4.4.4
Unpacked Size
56.82 kB
Size
13.27 kB
File Count
13
NPM Version
6.14.13
Node Version
14.17.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-40%
3
Compared to previous week
Last month
42.9%
20
Compared to previous month
Last year
-47.9%
385
Compared to previous year
Test your React application with the axe-core accessibility testing library. Results will show in the Chrome DevTools console.
Previous versions of this program were maintained at dequelabs/react-axe.
Install the module from NPM or elsewhere
1npm install --save-dev @axe-core/react
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.
1const React = require('react'); 2const ReactDOM = require('react-dom'); 3 4if (process.env.NODE_ENV !== 'production') { 5 const axe = require('@axe-core/react'); 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.
@axe-core/react 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. This can be disabled by setting disableDeduplicate: true
in the configuration object as shown in the example here.
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, @axe-core/react now runs accessibility tests inside of open Shadow DOM. You don't have to do anything special other than run @axe-core/react 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
1const config = { 2 rules: [ 3 { 4 id: 'skip-link', 5 enabled: true 6 } 7 ], 8 disableDeduplicate: true 9}; 10 11axe(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
1const 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.
No vulnerabilities found.
No security vulnerabilities found.