option

Term side of the Card.
Topic: Basic Control Elements
Unit title: option
Categories: Role
Explanation side of the Card

Explanation: The role used to represent an individual item within a selectable list or menu. It helps users identify choices available within a larger set of options.

Example

Wronghtml
<div role="listbox" aria-label="Size">
  <div class="selected">S</div>
  <div>M</div>
</div>
Righthtml
<div role="listbox" aria-label="Size">
  <div role="option" aria-selected="true">S</div>
  <div role="option" aria-selected="false">M</div>
</div>

Each item is exposed as an option with its selection state, so screen readers read 'S, selected, 1 of 2'.

Common mistakes

  • Using role='option' on items outside any listbox, so screen readers ignore the context.

Key points

  • Each role='option' is inside a listbox or a group within one.
  • Selectable options have aria-selected that matches the visual selection.
  • Options contain only text or images, never buttons, links or inputs.

Interview questions

Does the HTML option element have the option role?

Yes. <option> inside <select> or <datalist> maps to option automatically.

How do I group options in a listbox?

Wrap them in an element with role='group' and an accessible name, like <optgroup label> does in a <select>.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy