When a button lacks an accessible name, screen readers announce it simply as "button" with no indication of what it does. Users must guess whether it submits a form, opens a menu, or deletes their data.
Lighthouse flags <button> elements and elements with role="button" that have no discernible text. The audit checks for visible text content, aria-label, aria-labelledby, or title attributes. Buttons containing only icons, images without alt text, or empty content will fail this audit.
aria-label, or child elements with textThe most straightforward fix is visible text that describes the action.
<!-- Before: empty button -->
<button onclick="submitForm()"></button>
<!-- After: descriptive text -->
<button onclick="submitForm()">Submit application</button>
<!-- Before: button with only whitespace -->
<button type="submit"> </button>
<!-- After: meaningful text -->
<button type="submit">Save changes</button>
When design requires icon-only buttons, provide an accessible name.
<!-- Before: icon button with no name -->
<button class="close-btn">
<svg class="icon-x">...</svg>
</button>
<!-- After: aria-label names the action -->
<button class="close-btn" aria-label="Close dialog">
<svg class="icon-x" aria-hidden="true">...</svg>
</button>
<!-- Menu toggle button -->
<button aria-label="Open navigation menu" aria-expanded="false">
<svg aria-hidden="true"><!-- hamburger icon --></svg>
</button>
Include full text for screen readers while showing only an icon visually.
<button type="button">
<svg aria-hidden="true"><!-- trash icon --></svg>
<span class="sr-only">Delete item</span>
</button>
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
When a button contains an image, the alt text provides the name.
<!-- Before: image button without alt -->
<button type="submit">
<img src="/icons/search.png">
</button>
<!-- After: alt describes the action -->
<button type="submit">
<img src="/icons/search.png" alt="Search">
</button>
UButton handles accessibility automatically when you provide a label. For icon-only buttons, always add aria-label:<!-- Icon-only button with accessible name -->
<UButton
icon="i-heroicons-trash"
color="red"
variant="ghost"
aria-label="Delete item"
@click="deleteItem"
/>
<!-- Button with visible label (automatically accessible) -->
<UButton
label="Save changes"
@click="save"
/>
label prop for visible text or aria-label for icon-only buttons.title attribute — While title can provide an accessible name, it's not reliably announced by all screen readers and only shows on hoverButton name issues often appear alongside:
Icon buttons often repeat in headers, toolbars, cards, and interactive components throughout your site. Unlighthouse scans every page automatically, finding all buttons lacking accessible names so you can address them comprehensively rather than discovering them one complaint at a time.