The search button opens the article search, but a screen-reader user may encounter a button with no name. The magnifying glass tells sighted readers what to expect. Chrome DevTools can show what name the browser actually exposes for the control.
Inspect the computed name in Chrome
- Open the page in Chrome and inspect the search control. In Elements, select the actual
<button>, rather than its decorative SVG. - Open the Accessibility pane. Under Computed Properties, look for the Role and Name. If the pane is hidden, check the sidebar’s overflow menu.
- Check the name against the action. If the role is
buttonbut Name is blank or says something generic like “icon”, update the component and recheck the rendered page. Inspect the mobile menu too if it uses a separate control.
Compare three buttons in the browser
SEOWithJack used Chrome 157 to inspect three local controls. The two icon buttons used the same SVG with aria-hidden="true". The third used visible text.
| Control | Role | Computed name |
|---|---|---|
| Icon alone | Button | Empty |
Same icon with aria-label="Search articles" | Button | Search articles |
| Visible text “Search articles” | Button | Search articles |
On the labeled control, Enter and Space each fired the test action while the button had focus. That exercise verified native button activation and Chrome’s accessibility tree. Test the actual site with a screen reader and keyboard to check the full interaction.
Name the action in the shared component
Use visible button text where the design allows it. For an icon-only control, give the native button an action label with aria-label and keep its decorative SVG out of the accessibility tree. “Search articles” describes the action more clearly than “Magnifying glass”. In multilingual headers, provide the label in the current language.
Fix the shared header or block so the label carries through to every instance. In WordPress, check whether the control is part of a shared Navigation block or the theme header before editing individual pages. Our website checklist covers other checks to run when you update navigation.
Frequently asked questions
How do I give an icon button a name in HTML?
Put the action text inside the button if it should be visible. For icon-only controls, put the accessible label on the button itself. Confirm the computed name after rendering.
Does aria-label provide the same information as aria-describedby?
No. The name identifies the control. A description provides extra context. Check the Name field if the problem is an unnamed button.
Does a good accessible name finish the keyboard check?
No. Tab to the real control, confirm focus is visible, activate it and see where focus goes. If search opens a dialog, check that you can use and close it from the keyboard.
