Accessibility Notation
With SPECCER, you can also display accessibility notation, like Accessibility Bluelines or A11y Annotation Kit:
Prior art: Jeremy Elder and Stephanie Hagadorn
INFO
For more technical documentation, see the relevant documentation under the API-section.
Usage
Via <script>-tag
<script src="https://unpkg.com/@phun-ky/speccer/dist/speccer.js"></script>
<div data-speccer="a11y tabstops|landmark|headings|autocomplete|shortcut">
…
</div>Programmatically
<div data-speccer="a11y tabstops|landmark|headings|autocomplete|shortcut">
…
</div>import { a11y } from '@phun-ky/speccer';
a11y();Lazy loading
With data-lazy or modes.lazy(), accessibility annotations aren't drawn yet. See troubleshooting for a workaround.
Tab Stops

If you want to display tab stops, append data-speccer="a11y tabstops" as an attribute to the container you want to display the tab stops in. The tab stops are numbered in the order the Tab key visits them: positive tabindex values first, then the rest in document order. A group of radio buttons is one tab stop, on the checked radio, or the first one when none is checked.
Tab Order Path
Add path to draw a line from each tab stop to the next:
<div data-speccer="a11y tabstops path">…</div>When focus moves against the reading order, up or back along a row, the line is dashed and red. That may break WCAG 2.4.3 Focus Order. The color is --ph-speccer-a11y-tabstops-backwards-color.
The lines need the #ph-speccer-svg element in the document.
Landmarks And Regions

If you want to display landmarks and regions, append data-speccer="a11y landmark" as an attribute to the container you want to display the landmarks and regions in.
Headings

If you want to display headings, append data-speccer="a11y headings" as an attribute to the container you want to display the headings in.
Autocomplete

If you want to display autocomplete, append data-speccer="a11y autocomplete" as an attribute to the container you want to display the autocomplete in.
Contrast
If you want to check the text contrast, append data-speccer="a11y contrast" as an attribute to the container. Each element with its own text gets a label with its WCAG 2 contrast ratio and the level it meets:
| Label | Normal text | Large text |
|---|---|---|
AAA | 7:1 | 4.5:1 |
AA | 4.5:1 | 3:1 |
Fail, red | below 4.5:1 | below 3:1 |
Large text is 24px or more, or 18.66px (14pt) or more and bold. The ratio is truncated, not rounded, so 4.499:1 shows as 4.49:1 and fails.
The background is found by blending the background colors of the element and its ancestors, down to the first opaque one, or white. The label is ? when that can't tell the color behind the text: over a background image or gradient, or with opacity below 1. Content painted behind the text from elsewhere, like an absolutely positioned element, isn't seen either, so check those by eye.
Keys And Shortcut

If you want to display the shortcut with keys used for elements, use data-speccer="a11y shortcut" and data-speccer-a11y-shortcut="<shortcut>" on the element that uses this shortcut:
<button
type="button"
data-speccer="a11y shortcut"
data-speccer-a11y-shortcut="ctrl + s"
>
Save
</button>