Accessibility
a11y/option-no-interactive
Options in a listbox or combobox popup hold only text and images, never links, buttons or fields.
seriousstaticWCAG 4.1.2 · Afe-a11y-combobox
Why
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.
Fix
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.
Examples
<!-- 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>Sources
Facts
- Id
a11y/option-no-interactive- Severity
- serious
- Check
- static checked in the source by
audit - Applies to
htmlangularvuesvelteastrojsx- WCAG 2.2
- 4.1.2, level A
- Same problem in
- axe-core
nested-interactive - Taught by the skill
fe-a11y-comboboxCombobox, listbox and custom select- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain a11y/option-no-interactive