Accessibility
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.
seriousbrowserWCAG 2.5.8 · AAfe-a11y-visual
Why
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.
Fix
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.
Examples
/* bad: a 16px icon with no padding */
.close { width: 16px; height: 16px; padding: 0; }
/* good */
.close { min-width: 24px; min-height: 24px; padding: 4px; }Sources
Facts
- Id
a11y/target-size- Severity
- serious
- Check
- browser needs a rendered page:
audit --url - Applies to
page- WCAG 2.2
- 2.5.8, level AA
- Same problem in
- axe-core
target-size, Lighthousetarget-size - Taught by the skill
fe-a11y-visualContrast, colour, size and reflow- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain a11y/target-size