Skip to content

useControlLabel (HTML)

biome.json
{
"linter": {
"rules": {
"nursery": {
"useControlLabel": "error"
}
}
}
}

Enforce that interactive control elements have an accessible label.

A control with no accessible label is announced by assistive technology as an anonymous control (e.g. just “button”), leaving its purpose unclear. A label can come from text content, aria-label, aria-labelledby, or title attribute.

This rule checks native controls whose accessible name is expected to come from their own content or attributes (button, menuitem). Elements hidden from assistive technology with aria-hidden are skipped, as are elements that already require a text alternative under a dedicated rule (e.g. area, img, checked by useAltText).

<button></button>
code-block.html:1:1 lint/nursery/useControlLabel ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This control element has no accessible label.

> 1 │ <button></button>
^^^^^^^^^^^^^^^^^
2 │

Assistive technology announces it as an anonymous control, so its purpose is unclear to screen-reader users.

Add text content, or an aria-label, aria-labelledby, or title attribute.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<button> </button>
code-block.html:1:1 lint/nursery/useControlLabel ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This control element has no accessible label.

> 1 │ <button> </button>
^^^^^^^^^^^^^^^^^^^^
2 │

Assistive technology announces it as an anonymous control, so its purpose is unclear to screen-reader users.

Add text content, or an aria-label, aria-labelledby, or title attribute.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<button>Submit</button>
<button aria-label="Close"></button>
<button><span>Delete</span></button>