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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?
去到頂部