This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

accessibilityjs

1.1.2 • Public • Published

accessibilityjs build status

Client side accessibility error scanner.

Install

npm install accessibilityjs --save

Usage

import {scanForProblems} from 'accessibilityjs'
 
function logError(error) {
  error.element.classList.add('accessibility-error')
  error.element.addEventListener('click', function () {
    alert(`${error.name}\n\n${error.message}`)
  }, {once: true})
}
 
document.addEventListener('DOMContentLoaded', function() {
  scanForProblems(document, logError)
})

List of errors:

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

Scenario

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.

Development

> npm install
> npm test
> npm run example

Readme

Keywords

Package Sidebar

Install

npm i accessibilityjs

Weekly Downloads

3,322

Version

1.1.2

License

MIT

Unpacked Size

27.5 kB

Total Files

5

Last publish

Collaborators

  • andrialexandrou
  • jfuchs
  • githubbot
  • manuelpuyol
  • jonrohan
  • broccolini
  • primer-css
  • keithamus
  • colebemis
  • smockle
  • simurai
  • khiga8
  • dustin.greif
  • srt32
  • muan