Dostępność

a11y/target-size

Pointer targets are at least 24 by 24 CSS pixels, or spaced so a 24px circle on each does not touch another target.

poważnaw przeglądarceWCAG 2.5.8 · AAfe-a11y-visual

Dlaczego

Small, crowded targets (a close "×", pagination numbers, icon toolbars) are missed by people with tremors, limited dexterity or large fingers, and by anyone on a moving bus. New in WCAG 2.2; axe-core does not run its target-size rule by default, so it must be turned on.

Poprawka

Give icon buttons and small links min-width: 24px; min-height: 24px (44px is a comfortable size on touch screens), using padding so the icon stays small. Where a target must be smaller, keep 24px of spacing around its centre. Links inside sentences and controls drawn by the browser are exempt.

Przykłady

/* bad: a 16px icon with no padding */
.close { width: 16px; height: 16px; padding: 0; }
/* good */
.close { min-width: 24px; min-height: 24px; padding: 4px; }

Źródła

Fakty

Identyfikator
a11y/target-size
Waga
poważna
Sprawdzanie
w przeglądarce wymaga wyrenderowanej strony: audit --url
Dotyczy plików
page
WCAG 2.2
2.5.8, poziom AA
Ten sam problem w
axe-core target-size, Lighthouse target-size
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/target-size