Add readme and need for closest polyfill
This commit is contained in:
Родитель
5d6085997c
Коммит
ca1e2485ac
36
README.md
36
README.md
|
@ -1 +1,35 @@
|
|||
# accessibilityjs
|
||||
# accessibilityjs
|
||||
|
||||
Client side accessibility error scanner.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
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
|
||||
- Internet Explorer 11+
|
||||
- Microsoft Edge
|
||||
|
||||
Internet Explorer and Edge require a polyfill for [`closest`](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill).
|
||||
|
||||
## Development
|
||||
|
||||
Test script changes with `test.html`.
|
||||
|
|
Загрузка…
Ссылка в новой задаче