litepa11y
v0.6.15
Published
fast WCAG evaluation with puppeteer
Downloads
130
Readme
litepa11y
Litepa11y is a high performance web accessibility issue detector.
You need to have an active instance of puppeteer running with a connection to get started. This library does not open a new browser for you.
Getting Started:
npm i litepa11y --save
Requires node ^13
import { pa11y } from "litepa11y"
pa11y("https://example.com/").then((results) => {
// Do something with the results
});
litepa11y resolves with an array of objects, containing details about the page and accessibility issues:
{
documentTitle: 'The title of the page',
pageUrl: 'The URL that litepa11y was run against',
issues: [
{
code: 'WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2',
context: '<a href="https://example.com/"><img src="example.jpg" alt=""/></a>',
message: 'Img element is the only content of the link, but is missing alt text. The alt text should describe the purpose of the link.',
selector: 'html > body > p:nth-child(1) > a',
type: 'error',
typeCode: 1,
recurrence: 0
}
// more issues...
]
}
Runners
litepa11y supports multiple test runners which return different results. The built-in test runners are:
axe
: run tests using [aXe-core][axe].htmlcs
(default): run tests using [HTML CodeSniffer][htmlcs]
About
This project started as fork of pa11y out of performance needs.
LICENSE
check the license file in the root of the project.