Skip to content
Performance & Accessibility

A Practical Guide to Accessible Names and Roles

The name, role and state that assistive technology reports for every interface component, such as "Menu, button, collapsed", which custom widgets must provide explicitly.

Marcus Adeyemi Technical Director 2 min read 20 views
A Practical Guide to Accessible Names and Roles

Where most projects go wrong

The usual mistakes:

  • Div and span elements used as buttons
  • Icon buttons with no accessible name
  • States that change visually but not in code
  • ARIA roles that contradict the element's behavior

What good looks like instead

  • Use native elements before building custom ones
  • Give every control an accessible name
  • Update states such as aria-expanded when they change
  • Check names and roles with browser accessibility tools
  • Test custom widgets with a screen reader
What to do and what to avoid with accessible names and roles, side by side
Good practice against the usual mistakes, from the sources listed below.

Why it matters

Native HTML elements expose these automatically, but custom components often expose nothing, leaving screen reader users with unlabeled controls, which fails WCAG at level A.

The specs that matter

Published figures for Accessible Names and Roles
MeasureFigure
WCAG 4.1.2 Name, Role, Value, Athe name and role of components can be determined, and states can be set and changed
Native elementsbuttons, links and form controls expose name and role by default
Custom widgetsneed ARIA roles, states and properties
Common failureclickable div elements with no role or name

Knowing when to hand it over

Tip: Bring in help when a component library uses custom controls, or when screen reader users report unlabeled buttons.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

Marcus Adeyemi

Builds and maintains the web work. Writes about front-end architecture, performance, accessibility and the unglamorous parts of keeping a site alive.

Keep reading

More in Performance & Accessibility