Rule

Widget item names

Tabs, menu items, options and tree items need an accessible name.

Rule
composite-widget-name
WCAG 2.2
4.1.2 Name, Role, Value (opens in a new tab) (Level A)
Severity
Serious

What it checks

The rule looks at the items inside composite widgets: elements whose role is tab, menuitem, menuitemcheckbox, menuitemradio, option or treeitem, including a <button> or link given one of those roles. WAI-ARIA requires each of them to have a name, usually from its text. The rule fails an item with no text and no label, such as an icon-only tab, because a screen reader announces an unnamed tab and the user cannot tell what choosing it does. The containers, such as tablist and menu, are not judged.

Example

Fails

<div role="tablist" aria-label="Views">
  <button role="tab" aria-selected="true"><span class="icon-grid"></span></button>
  <button role="tab" aria-selected="false"><span class="icon-list"></span></button>
</div>

Passes

<div role="tablist" aria-label="Views">
  <button role="tab" aria-selected="true" aria-label="Grid view"><span class="icon-grid"></span></button>
  <button role="tab" aria-selected="false" aria-label="List view"><span class="icon-list"></span></button>
</div>

The engine is tested against both examples.

How to fix it

Put text inside each item, or add an aria-label to items that show only an icon.

Check your own pages

This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.