The Accessibility Developer Tools (ADT) library provides a suite of accessibility-related testing and utility code primarily for web browsers. Its core functionality includes an accessibility audit API, offering a collection of rules to check for common accessibility problems within an HTML page. Beyond auditing, it offers utilities such as contrast ratio calculation, ARIA attribute validation, and accessible name computation following WAI-ARIA specifications. The current stable version is 2.12.0, with a release cadence that appears somewhat irregular, often driven by bug fixes, performance enhancements, and new audit rules. Key differentiators include its focus on practical, rule-based audits for web content and its integration capabilities with testing frameworks like Selenium and headless browsers like PhantomJS. It's often used in CI/CD pipelines to automate accessibility checks.
npm install accessibility-developer-toolsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `accessibility-developer-tools` within a Node.js environment using Puppeteer to audit a web page. It injects the library into a headless browser, runs a full accessibility audit, and logs the results including failing elements.
Update calls to `axs.AuditRule.run()` to pass an options object as its single argument. Refer to the method documentation for the specific structure of the options object.
Ensure a recent version of JDK is installed and configured in your system's PATH. If encountering build errors related to Java or Closure Compiler, verify JDK installation.
For Node.js projects, upgrade to v2.11.0 or newer to ensure reliable CommonJS `require` support. If using older versions, consider loading the script directly into a JSDOM or similar browser-like environment.
For fine-grained control over audit behavior, upgrade to v2.9.0 or later and utilize the object-based configuration options as described in the documentation for `axs.Audit` initialization.
When using with frameworks that employ Shadow DOM, ensure the auditing tool can properly traverse shadow roots. The library's ability to descend into iframes (v2.8.0) is a positive sign, but Shadow DOM behavior might differ. Manual element selection or additional context might be necessary for elements within closed shadow roots.
Ensure the `axs_testing.js` script is included in your HTML page before any calls to `axs`, or if in Node.js, ensure `require('accessibility-developer-tools')` is executed and assigns `axs` to a global or local variable.Verify that a compatible JDK version is installed and accessible via your system's PATH variable. Check the specific error message from Closure Compiler for more details on the cause, which might indicate a bug in the source code being compiled.
This typically means the library loaded partially or an incorrect version. Ensure you are loading `axs_testing.js` (or the equivalent module export) and that it completes execution without errors. This can happen if dependencies for the library itself fail to load.