accessibilityjs

Client side accessibility error scanner.

  • 所有者: github/accessibilityjs
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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

概览

名称与所有者github/accessibilityjs
主编程语言JavaScript
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
发布数5
最新版本名称v1.1.1 (发布于 2018-03-09 17:02:00)
第一版名称1.0.1 (发布于 )
创建于2017-06-22 12:41:18
推送于2020-08-03 15:47:33
最后一次提交
星数2.2k
关注者数38
派生数72
提交数101
已启用问题?
问题数4
打开的问题数1
拉请求数13
打开的拉请求数4
关闭的拉请求数3
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?
去到顶部