Responsywność

responsive/no-hover-only

Nothing is revealed on hover alone; content and controls shown on hover also show on keyboard focus and are reachable on touch.

poważnastatyczneWCAG 2.1.1 · Afe-responsive

Dlaczego

Touch screens have no hover, and keyboard users never hover. Edit buttons, submenus or details that appear only under the mouse are missing for them, or appear only by accident on a tap.

Poprawka

Reveal the same content on :focus-within of the container (or :focus-visible of the trigger), and on touch show it by default or behind a button. With Tailwind, pair group-hover: with group-focus-within:. A menu that opens on hover also needs a button that opens it, and content that appears must stay until dismissed (Escape).

Przykłady

/* bad */
.card:hover .card__actions { display: flex; }
/* good */
.card:hover .card__actions,
.card:focus-within .card__actions { display: flex; }

Źródła

Fakty

Identyfikator
responsive/no-hover-only
Waga
poważna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
css scss less html vue svelte astro jsx angular
WCAG 2.2
2.1.1, poziom A
Uczy jej skill
fe-responsive Responsive design
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain responsive/no-hover-only