WebTech1223411 logo WebTech1223411Web tech, read closely
Accessibility

How to Label Accessible Icon Buttons for Screen Readers

A screen reader user lands on your toolbar and hears "button, button, button, button". Four icons that are obvious to a sighted user, a magnifier, a heart, a bell and a hamburger, are completely silent to anyone who cannot see them.

A developer's monitor showing a toolbar of icon buttons with the browser accessibility panel open beside the code editor

A screen reader user lands on your toolbar and hears "button, button, button, button". Four icons that are obvious to a sighted user, a magnifier, a heart, a bell and a hamburger, are completely silent to anyone who cannot see them. Accessible icon buttons need a text name that assistive technology can read, and it is one of the most common gaps in otherwise solid front-end code.

The fix takes a few minutes per component once you know the patterns. Here is how I label icon buttons on production projects, which methods to trust, and where the usual advice goes wrong.

Why icon buttons fail screen readers

A button gets its accessible name from its content. When the content is text, such as "Save", the browser uses that text. When the content is only an SVG or an icon font glyph, there is usually nothing to read. Some screen readers fall back to the file name of an image or announce the SVG title if one exists. Many announce only the role, which tells the user nothing.

Icon fonts are worse. Because the icon is a character in a private use area of the font, a screen reader may try to pronounce it, producing nonsense, or skip it entirely. Either way the user has to guess.

The result is a control that works for a mouse and fails for a keyboard and screen reader combination. Automated tools catch some of these, but not all, for reasons covered in why automated accessibility scanners miss most real problems.

Four ways to name accessible icon buttons

There are four reliable techniques. Each works, but they suit different situations.

MethodHow it worksBest for
aria-labelAttribute on the button with the name as its valueMost icon-only buttons
Visually hidden textA span inside the button, hidden visually with CSSNames that must translate reliably
aria-labelledbyPoints to the id of another element that holds the nameButtons labelled by nearby visible text
Visible text labelA short word next to or under the iconPrimary actions and unfamiliar icons

aria-label

Add aria-label="Search" to the button element itself and mark the SVG inside with aria-hidden="true" so it is not announced twice. This is the quickest fix and every major screen reader supports it. The weakness is translation. Some browser translation tools skip attribute values, so a French visitor using automatic translation may still hear the English label.

Visually hidden text

Put a real text span inside the button and hide it with a utility class, often called sr-only or visually-hidden. The class clips the element to one pixel, removes it from the visual flow and keeps it in the accessibility tree. Do not use display: none or visibility: hidden, because both remove the text for screen readers too. This method translates cleanly and survives most CMS rendering, which makes it my default for multilingual sites.

aria-labelledby

Use this when the name already exists on the page. A delete button inside a row of a file list can reference both its own hidden "Delete" text and the file name cell, so the screen reader announces "Delete invoice-march.pdf". That is far more useful than ten identical "Delete" buttons in a row.

Visible text

The most accessible icon button is often one that is not icon-only at all. A short visible label helps everyone, including sighted users who do not know what an unusual icon means.

Writing a good accessible name

A label that exists but says the wrong thing is barely better than none. Follow these rules:

  • Describe the action, not the picture. "Close" or "Close dialog", not "X". "Open menu", not "Hamburger".
  • Keep it short. One to three words in most cases. Screen reader users hear every word on every visit.
  • Do not include the role. Avoid "Close button". The screen reader already says "button".
  • Add context when there are repeats. "Remove item" repeated 12 times in a cart should become "Remove blue wool socks" and so on.
  • Match visible text if there is any. WCAG success criterion 2.5.3 Label in Name requires the accessible name to contain the visible label, so voice control users can say what they see.

Toggle buttons need state, not a new label

A lot of tutorials suggest swapping the label when an icon button toggles, changing "Mute" to "Unmute" on click. I would avoid that for most toggles.

When the label changes, a screen reader user who hears "Unmute" cannot easily tell whether that is the current state or the action. Instead, keep a stable label such as "Mute" and add aria-pressed="false" or aria-pressed="true". The screen reader then announces "Mute, toggle button, pressed" or "not pressed", which is clear and consistent. The same applies to a favourite heart, a bold button in an editor or a show password eye icon.

The exception is a button whose action really changes, such as a play button that becomes pause in a media player. Some teams prefer a changing label there, and major video players do both. Pick one approach and test it with real users.

Do not forget focus and size

An accessible name is only part of the job. Icon buttons also need to be reachable and usable.

  1. Use a real button element. A clickable div or span needs extra role, tabindex and keyboard handling, and it is easy to miss one. A native button gives you Enter and Space support for free.
  2. Keep a visible focus indicator. Icon buttons are where focus styles get removed most often, as described in why focus outlines keep getting removed from buttons and links.
  3. Make the target large enough. WCAG 2.2 asks for at least 24 by 24 CSS pixels. I aim for 44 by 44 on touch interfaces, using padding so the icon itself can stay 20 pixels.
  4. Check contrast. The icon needs a 3 to 1 contrast ratio against its background as a non-text graphic.

Close buttons in dialogs are a classic trouble spot, so if you are building one, pair these rules with the full pattern for an accessible modal dialog that works.

Testing your icon buttons

Open the accessibility panel in browser DevTools, select the button and read its computed name. If the name field is empty or shows something odd, fix it before moving on. Then do a quick real test: turn on VoiceOver on macOS with Command F5 or NVDA on Windows, Tab through the interface and listen. Five minutes of listening finds problems that no checklist does.

Frequently asked questions

Do icon buttons need an aria-label?

They need an accessible name, and aria-label is one common way to provide it. Visually hidden text or aria-labelledby work just as well. What matters is that the button has a meaningful name that screen readers can announce.

Should I use title attributes on icon buttons?

Do not rely on them. The title attribute shows a tooltip on mouse hover but is inconsistently announced by screen readers and never appears for keyboard or touch users. Use a proper accessible name and add a separate tooltip if sighted users need one.

Should the SVG inside a button be hidden from screen readers?

Yes, in most cases. Add aria-hidden="true" to decorative SVG icons when the button already has its own name. This prevents the screen reader from announcing the icon a second time or reading out an unhelpful title.

LV
Lorenzo Vidal

Lorenzo started as a visual designer and moved into CSS after watching too many of his layouts fall apart on phones. He writes about front-end craft, interfaces and accessibility, and still tests everything with the keyboard first.

More posts by Lorenzo

More in Accessibility

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto