项目作者: raunofreiberg

项目描述 :
Accessibility testing visualized
高级语言: TypeScript
项目地址: git://github.com/raunofreiberg/axe-mode.git
创建时间: 2020-04-28T19:04:40Z
项目社区:https://github.com/raunofreiberg/axe-mode

开源协议:MIT License

下载


axe-mode

npm

WIP

This project is an attempt to leverage axe-core in a component to find accessibility violations and provide information on how to resolve them.

Currently, this only works for React.

See it in action on CodeSandbox.

Demo

Usage

Install the library:

  1. yarn add axe-mode -D

or

  1. npm install axe-mode --save-dev

Import the component and wrap it around your application or any other component tree you would like to validate:

  1. import AxeMode from 'axe-mode';
  2. function App() {
  3. return (
  4. <AxeMode disabled={process.env.NODE_ENV !== 'development'}>
  5. <h1 aria-expanded="123">Hello world!</h1>
  6. </AxeMode>
  7. );
  8. }

Launch your application as usual. Any violations of accessibility will show up as an overlay. If you wish to interact with your application, overlays can be toggled on/off with Ctrl + I.

You can safely leave the component around your application since this whole library and its dependencies will be dropped in production.

Note: Make sure to only run in production by using the disabled prop with your environment variable.