Dostępność

a11y/option-no-interactive

Options in a listbox or combobox popup hold only text and images, never links, buttons or fields.

poważnastatyczneWCAG 4.1.2 · Afe-a11y-combobox

Dlaczego

An option's content is presentational: assistive technology reads it as one piece of text. A "Remove" button inside cannot be reached with the listbox keys and may be read as part of the option's name.

Poprawka

Keep the option to text, icons and images. Put row actions outside the list (a toolbar that acts on the selected option), or switch to the grid pattern when each row needs its own controls.

Przykłady

<!-- bad -->
<li role="option">Anna <button>Remove</button></li>
<!-- good -->
<li role="option" aria-selected="true">Anna</li>
<button type="button">Remove selected recipient</button>

Źródła

Fakty

Identyfikator
a11y/option-no-interactive
Waga
poważna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html angular vue svelte astro jsx
WCAG 2.2
4.1.2, poziom A
Ten sam problem w
axe-core nested-interactive
Uczy jej skill
fe-a11y-combobox Combobox, listbox and custom select
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/option-no-interactive