Client side accessibility error scanner.
Перейти к файлу
Mu-An ✌️ Chiou 0892b2cf9e Change package.json for prepublish command 2017-10-06 09:54:19 +08:00
.babelrc Add umd build script 2017-10-06 09:44:08 +08:00
.eslintrc Fix eslint and point to the right main file 2017-10-06 09:51:34 +08:00
.gitignore Add babel for es2015 2017-10-06 09:30:42 +08:00
LICENSE Add license text 2017-06-26 23:42:08 +08:00
README.md Update browser support 2017-09-28 15:56:08 +08:00
index.js Add umd build script 2017-10-06 09:44:08 +08:00
package-lock.json Add babel for es2015 2017-10-06 09:30:42 +08:00
package.json Change package.json for prepublish command 2017-10-06 09:54:19 +08:00
test.html Move polyfill to test.html so people can use their own polyfillz 2017-09-28 15:28:40 +08:00

README.md

accessibilityjs

Client side accessibility error scanner.

Usage

import scanForProblems from 'accessibilityjs'

function logError(error, onPageWarning = true) {
  error.element.addEventListener('click', function () {
    alert(`${error.name}\n\n${error.message}`)
  }, {once: true})

  if (onPageWarning) error.element.classList.add('accessibility-error')
}

document.addEventListener('ready', function() {
  scanForProblems(document, logError)
})

Browser support

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

Internet Explorer and Edge require a polyfill for closest.

Development

Test script changes with test.html.