0.7.0 • Published 1 year ago
@github/axe-github v0.7.0
axe-github
Custom rules and configuration recommendations for the axe-core library for GitHub projects.
Custom rules
These are the custom rules contained in this package:
aria-attribute-is-validautofocus-in-dialogavoid-both-disabled-and-aria-disabledempty-summarymenuitem-should-be-interactivenested-formsredundant-aria-label-aria-labelledbysubmit-reset-button-must-be-in-form
Configuration
We recommend running axe-core defaults.
Basic usage
import axe from 'axe-core'
import customRules from '@github/axe-github'
axe.configure(customRules)
axe.run(...)Playwright configuration
For the custom rules in this library, their associated check functions are not serializable to a Playwright page. To configure axe, you'll need to load and evaluate configure-browser.ts within the page context. Axe should be loaded on the page before configuring.
const configSrc = fs.readFileSync(
require.resolve('@github/axe-github/configure-browser'),
'utf8'
)
page.evaluate((configSrc) => {
window.eval(configSrc)
}, configSrc)