a11y-audit-lite
v0.1.0
Published
Framework-agnostic accessibility audit utility — scans a DOM tree for common a11y issues (missing alt text, unlabeled inputs, empty links/buttons, duplicate ids, missing lang).
Maintainers
Readme
a11y-audit-lite
Framework-agnostic accessibility audit for any DOM tree — no headless browser, no CI service. Works against real DOM, jsdom, or any ParentNode.
Install
npm install a11y-audit-liteQuick start
import { audit, formatReport } from 'a11y-audit-lite';
const issues = audit(document.body);
console.log(formatReport(issues));Use it in a unit test:
test('page has no a11y regressions', () => {
render(<MyComponent />);
expect(audit(document.body)).toEqual([]);
});Checks included
img-alt— images missing analtattributeaccessible-name— links/buttons with no text,aria-label, oraria-labelledbyinput-label— form controls with no associated<label>duplicate-id— more than one element sharing anidhtml-lang— document missing alangattribute
API
audit(root, options?)— returns anA11yIssue[];options.disableskips specific rule idsformatReport(issues)— human-readable multi-line summary
What's out of scope
Color contrast, focus order, and ARIA-role validity need real layout/rendering info this package doesn't have — pair it with a full tool (axe-core) for those; a11y-audit-lite covers the zero-dependency, DOM-structure checks that don't need a browser.
License
MIT
