Add react-axe as plugin to Storybook
vepor opened this issue ยท 9 comments
Because of a11y reasons, it would be great to add react-axe
as accessibility checker for both the production and development build.
Hey @sanskar-p
We are already using eslint-plugin-jsx-a11y
for the @kiwicom/orbit-components
, but feel free to get your hands on react-axe
and integrate it with storybook
!
What we want to do here is to add the react-axe
to be loaded with the storybook.
This can be easily implemented into preview.js
file.
It can be implemented as a addon or just used with normal import.
Let me know @sanskar-p if will do this, otherwise somebody else or our core team can handle it.
Yes, it should @sanskar-p
Also it seems that react-axe
is deprecated, so it would be better to use @axe-core/react
instead, so we will get updates in the future.
@sanskar-p also, you can use ES6
syntax, e.g.
import { addDecorator, addParameters } from "@storybook/react";
import * as React from "react";
import * as ReactDOM from "react-dom";
import "loki/configure-react";
import orbitTheme from "./orbitTheme";
import orbitDecorator from "./orbitDecorator";
if (process.env.NODE_ENV !== "production") {
import("@axe-core/react").then(axe => axe(React, ReactDOM, 1000));
}
Also check this addon-a11y. It has axe
under the hood
Also check this addon-a11y. It has
axe
under the hood
This is probably the best choice