github

accessibilityjs

Client side accessibility error scanner.
Under MIT License
By github

accessibility

accessibilityjs

Client side accessibility error scanner.


Install

npm install accessibilityjs --save


Usage

```javascript
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:



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.




Browser support

Internet Explorer and Edge require a polyfill for closest.


Development

```bash



npm install
npm test
npm run example
```