Skip to content
Client side accessibility error scanner.
JavaScript HTML
Branch: master
Clone or download
mislav Merge pull request #22 from github/check-hasattribute
Check for `el.hasAttribute` before invoking
Latest commit 1b0731d May 11, 2018

accessibilityjs build status

Client side accessibility error scanner.


npm install accessibilityjs --save


import {scanForProblems} from 'accessibilityjs'

function logError(error) {
  error.element.addEventListener('click', function () {
  }, {once: true})

document.addEventListener('DOMContentLoaded', function() {
  scanForProblems(document, logError)

List of errors:

  • ImageWithoutAltAttributeError
  • ElementWithoutLabelError
  • LinkWithoutLabelOrRoleError
  • LabelMissingControlError
  • InputMissingLabelError
  • ButtonWithoutLabelError
  • ARIAAttributeMissingError


In GitHub we use this script to scan for inaccessible elements in development and production staff mode. We style the elements with red borders in the logError function passed in, and add a click handler explaining the reasons.

Red borders are added to offending elements example

An alert pops up on clicking the elements

Browser support

  • Chrome
  • Firefox
  • Safari 6+
  • Internet Explorer 9+
  • Microsoft Edge

Internet Explorer and Edge require a polyfill for closest.


> npm install
> npm test
> npm run example
You can’t perform that action at this time.