Dostępność

a11y/non-text-contrast

Borders of fields, checkboxes, toggles, focus rings and meaningful icons have at least 3:1 contrast with their neighbours.

poważnaręczneWCAG 1.4.11 · AAfe-a11y-visual

Dlaczego

A text field drawn with a pale grey line on white, or a toggle whose on and off states differ only slightly, cannot be found or read by people with low vision. No automated engine checks this today.

Poprawka

Give the boundary that identifies a control (input border, checkbox box, switch track) and every state indicator 3:1 against the adjacent colour. The focus ring needs 3:1 too. Icons that carry meaning without text (a warning sign, a chart line) need 3:1 against their background.

Przykłady

/* bad: #e5e7eb border on white is about 1.2:1 */
input { border: 1px solid #e5e7eb; }
/* good: #6b7280 on white is about 4.8:1 */
input { border: 1px solid #6b7280; }

Źródła

Fakty

Identyfikator
a11y/non-text-contrast
Waga
poważna
Sprawdzanie
ręczne ocenia człowiek; raport podaje to jako listę kontrolną
Dotyczy plików
css scss less page
WCAG 2.2
1.4.11, poziom AA
Uczy jej skill
fe-a11y-visual Contrast, colour, size and reflow
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/non-text-contrast