Accessible Names Explained: Which Label Does a Screen Reader Read?
How browsers compute accessible names from aria-labelledby, aria-label, labels, alt and content, and how to debug empty or mismatched control names.

Every interactive element needs a name. It is what a screen reader announces when focus lands on a button, what a braille display shows for a link, and what a voice-control user says to click something. Browsers compute this accessible name with a fixed algorithm, and most naming bugs come from not knowing which step wins. This guide explains the steps and shows how to trace them with the Accessible Name and Role Debugger.
The naming order
For most elements the browser tries these sources in order and stops at the first one that gives text:
- aria-labelledby: the text of the elements whose ids are listed.
- aria-label: the attribute's own text.
- Native labelling: a label element for inputs, selects and textareas; alt for images; legend for a fieldset; caption for a table; figcaption for a figure; the value of a submit button.
- Content: for roles that take their name from content, such as button, link, heading and tab, the text inside, including alt text of images within it.
- title, and for fields placeholder, as a last resort.
Two consequences surprise people. First, aria-label replaces the visible text completely; it does not add to it. Second, an icon-only button with an SVG and no title has no name at all, because there is no text anywhere in the chain.
Roles come first
The name only makes sense together with the role. The debugger shows each element's role, either from a role attribute or from the element's implicit role: an a with href is a link, an a without href is not; a select is a combobox unless it is multiple; a page-level header is a banner, but a header inside an article is not. Writing role="button" on a button is harmless but redundant, and the tool notes it.
Using the debugger
Paste HTML: a form, a component or a whole page. The table lists every control and image with its line, role, computed name and the source of that name. Select a row and the trace appears. It lists every source the algorithm looked at, the text it found, which one was used, and notes such as an aria-labelledby id that does not exist, an empty aria-label that is ignored, or an empty alt that marks an image as decorative. You also see the description from aria-describedby, the visible text, and a rough line of what a screen reader would say, with the element highlighted in your source.
Tick show only problems to focus on failures, or include every element to inspect the rest of the page. The table exports as CSV.
What the debugger flags
- Buttons, links, form fields, iframes and widget roles with no name
- Images without an alt attribute
- Names that come only from a placeholder or a title tooltip
- aria-labelledby pointing at ids that are missing
- Focusable elements inside aria-hidden="true"
- Vague names such as Read more or Click here
- Alt text that is just a file name
- Label in Name failures, where the aria-label does not contain the visible text
Why Label in Name matters
WCAG 2.5.3 asks that the accessible name of a control with visible text includes that text. A button that shows Cancel but has aria-label="Close dialog" fails: a voice-control user says "click Cancel" and nothing happens, because the browser only knows Close dialog. The fix is to start the aria-label with the visible word, for example "Cancel and close dialog", or drop aria-label altogether.
A worked example
A sign-in form has an email field with a proper label, a search box with only a placeholder, a checkbox wrapped in its label, an icon button with an SVG, a trash button with only a title, and a Cancel button with aria-label Close dialog. The debugger names the email field and checkbox correctly from their labels. It flags the search box (placeholder only), the icon button (no name), the trash button (title only) and the Cancel button (Label in Name). Each fix takes one attribute or one visible label.
Limits worth knowing
The tool follows the common paths of the specification, but it is not a full browser. CSS-generated content, shadow DOM, names set by script after load and elements hidden by external stylesheets are outside its view. For those, confirm in the accessibility pane of your browser's DevTools, which shows the final computed name for any element.



