‘Fixing Lighthouse “Buttons do not have an accessible name”‘
When Lighthouse's accessibility audit reports "Buttons do not have an accessible name" (the Japanese-language report shows this in Japanese, meaning roughly "no accessible name is specified for the button"), the page has a button that has no name for screen readers. Adding aria-label to the button, adding alt to the img inside it, or putting text that is hidden from view inside the button clears the warning. Buttons without names are usually icon-only buttons with no text inside, such as a hamburger menu, a search button, or a close "×" button.
I ran Lighthouse on a test page with three icon-only buttons, confirmed that the warning appears, and confirmed that it goes away after I fixed the buttons.
The test environment was Ubuntu 24.04, Node.js 22.23.4, and Lighthouse 13.6.0 (the CLI installed with npm; it uses axe-core 4.14.0 internally). The browser was headless Google Chrome for Testing 153. I ran only the accessibility category (--only-categories=accessibility) with the default mobile settings. I wrote the page myself and served it from 127.0.0.1. I did not test the Lighthouse panel in Chrome DevTools, PageSpeed Insights, or reading with a real screen reader.
The page that triggers the warning
The test page has three icon-only buttons. I used three ways to draw the icon: SVG, img, and CSS.
<!-- 1. Button with only an SVG icon -->
<button type="button" class="menu">
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="#1f2a30" stroke-width="2"/></svg>
</button>
<!-- 2. Button with only an img that has no alt -->
<button type="button" class="search"><img src="icon.svg" width="24" height="24"></button>
<!-- 3. Button with a CSS-drawn icon (empty inside) -->
<button type="button" class="close"><span class="icon-close"></span></button>
I served this page with python3 -m http.server and ran Lighthouse like this:
npx lighthouse http://127.0.0.1:8000/bad.html \
--only-categories=accessibility \
--output=json --output=html --output-path=./out/bad \
--chrome-flags="--headless=new --no-sandbox" --quiet
In the HTML report, all three buttons were listed under "Failing Elements".

From the JSON report, here are the accessibility score and the result of this audit. The three buttons fail for the same reason, so I show only the first one. I also left out lines such as the Lighthouse version and the score breakdown.
accessibility score: 77
button-name title: Buttons do not have an accessible name
button-name score: 0
- body > main > button.menu | <button type="button" class="menu">
Fix any of the following:
Element does not have inner text that is visible to screen readers
aria-label attribute does not exist or is empty
aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
Element has no title attribute
Element does not have an implicit (wrapped) <label>
Element does not have an explicit <label>
Element's default semantics were not overridden with role="none" or role="presentation"
failed accessibility audits: button-name, image-alt
The list under "Fix any of the following" shows the ways to give the button a name. A button passes if it meets any one of them. This check comes from the button-name rule in axe-core, which Lighthouse uses internally. The rule accepts any (any) of the following: text inside the button, aria-label, aria-labelledby, a title attribute, or a label element association.
The second button's img (button.search > img) has no alt, so it was also flagged by "Image elements do not have [alt] attributes" (image-alt).
Three ways to fix it
Making the following changes cleared the warnings. The buttons look the same as before.
<!-- 1. Give it a name with aria-label -->
<button type="button" class="menu" aria-label="メニューを開く">
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="#1f2a30" stroke-width="2"/></svg>
</button>
<!-- 2. Add alt to the img -->
<button type="button" class="search"><img src="icon.svg" width="24" height="24" alt="検索"></button>
<!-- 3. Add text that is hidden from view -->
<button type="button" class="close"><span class="icon-close"></span><span class="visually-hidden">閉じる</span></button>
The visually-hidden class in the third example is CSS that shrinks the text into a 1-pixel box, so it is invisible on screen.
.visually-hidden {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
The right fix depends on how the button is built. If the button contains only an SVG, aria-label is the quickest option. If the icon is an img, putting the button's action in alt also gives the button its name. If the button is empty because the icon is drawn with CSS, adding text hidden from view also gives it a name.
I ran Lighthouse again under the same conditions. The warning was gone and the score was 100 (I left out the score breakdown and other lines):
accessibility score: 100
button-name title: Buttons have an accessible name
button-name score: 1
failed accessibility audits: (none)
I also checked the button names with Playwright's ariaSnapshot(). Before the fix, the buttons were unnamed button elements. After the fix, the name came from aria-label, alt, and the hidden text, respectively.
--- bad.html
- main:
- heading "メモの一覧" [level=1]
- button
- button:
- img
- button
--- good.html
- main:
- heading "メモの一覧" [level=1]
- button "メニューを開く"
- button "検索":
- img "検索"
- button "閉じる"
Fixes that look right but do not clear the warning
I also tested the following three approaches. Only the button with a title attribute was removed from Failing Elements.
<!-- 1. Text with display: none -->
<button type="button" class="menu"><span style="display: none">メニューを開く</span>
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="#1f2a30" stroke-width="2"/></svg>
</button>
<!-- 2. img with an empty alt -->
<button type="button" class="search"><img src="icon.svg" width="24" height="24" alt=""></button>
<!-- 3. Only a title attribute -->
<button type="button" class="close" title="閉じる"><span class="icon-close"></span></button>
These are the Lighthouse results. I left out the "Fix any of the following" lines and the reason lines under each button, because they are the same as before the fix. I also left out the score breakdown and other lines.
accessibility score: 89
button-name title: Buttons do not have an accessible name
button-name score: 0
- body > main > button.menu | <button type="button" class="menu">
- body > main > button.search | <button type="button" class="search">
failed accessibility audits: button-name
The names from ariaSnapshot() were as follows:
--- partial.html
- main:
- heading "メモの一覧" [level=1]
- button
- button
- button "閉じる"
Text hidden with display: none did not become the button's name. In ariaSnapshot(), the first button was still an unnamed button. If you want to hide text visually but keep it for screen readers, use CSS like the visually-hidden class above, not display: none.
alt="" clears the image-alt warning, but it does not name the button. The description of image-alt in the report also says that decorative images can be removed from screen reader output by giving them an empty alt. If the image inside a button is what conveys the button's action, put words in alt.
A button with only title="閉じる" passed, and ariaSnapshot() showed the name as 閉じる (meaning "Close"). This is because the axe-core rule accepts the title attribute as one of the ways to name a button.
One unnamed button keeps the score from reaching 100
The Lighthouse accessibility score is a weighted average of the audits. In the default configuration for Lighthouse 13.6.0, button-name has a weight of 10. That is among the highest weights, the same as image-alt.
Each audit scores 0 if axe-core finds at least one violation, and 1 otherwise. In my test, on the page where I fixed only one button and two unnamed buttons remained, button-name stayed at 0. I recalculated the scores from the weights in the JSON report, and the results were as follows:
| Page | Failed audits | Calculation | Score |
|---|---|---|---|
| Before fixing | button-name, image-alt |
68 / 88 | 77 |
| Page with the non-working fixes mixed in | button-name |
79 / 89 | 89 |
| After fixing | None | 132 / 132 | 100 |
The denominator differs by page because audits that do not apply to a page are excluded from the calculation. For example, ARIA attribute audits are excluded when the page does not use aria-label. The page with the non-working fixes had a denominator of 89 because it had an image with alt="", which added presentation-role-conflict (weight 1) to the calculation. The fixed page used aria-label, so the ARIA attribute audits were added to the calculation, and the denominator became 132.





