An icon is not a complete button
A recognizable symbol makes a toolbar compact, but it does not replace an accessible name. Use a real button for an action and a link for navigation. A control that opens an account menu should describe that action, not merely announce “user”. A visible text label is often the clearest solution.
Name the action, not the picture
“Download SVG” is more useful than “down arrow”. “Save to favorites” is more useful than “heart”. Give icon-only buttons accessible names and prevent decorative SVGs from being announced separately. When visible wording already describes the action, repeating it in the graphic can create unnecessary noise.
<button type="button" aria-label="Download SVG">
<svg aria-hidden="true" viewBox="0 0 24 24">…</svg>
</button>Communicate state
A favorite toggle has active and inactive states. Expose the pressed state and make the visual treatment distinct. A disclosure should report whether it is expanded. Keep those attributes synchronized with the actual interaction. A decorative color change alone is not sufficient.
Support keyboard and touch
Check keyboard reachability and visible focus. A small drawing does not require a tiny click target: give the artwork adequate surrounding space. Help shown only on mouse hover excludes touch users and may be difficult for keyboard users. Offer the explanation through focus or an explicit control as well.
Reinforce meaning with color
A red cross can support an error message, but the text should identify the problem and the next step. A green check should follow a real success response. Someone who cannot distinguish the colors should still understand the outcome.
Plan labels before editing the download or heart artwork. For detailed patterns, consult the WAI button guidance.
Test the entire control in context
A button can have valid ARIA markup and still be difficult to operate. Try the page with only a keyboard, with 200% browser zoom, and with visible labels enabled. A tooltip that appears only on hover is not a substitute for a label available on focus and to assistive technology. Review disabled, loading and error states as carefully as the normal state.
If a toggle changes state, update the state communicated to the user. For example, a bookmark control should tell someone whether an item is saved. Use visible text when space permits; if you use an icon-only control, give the button a meaningful accessible name and test it. See the SVG accessibility examples and navigation patterns.
Write names users can act on
An accessible name should read like an instruction, not a caption. Compare the two columns: the left name tells a screen-reader user what will happen, the right name only describes the picture.
| Action (good name) | Picture (weak name) |
|---|---|
| Download SVG | Down arrow |
| Save to favorites | Heart |
| Open search | Magnifying glass |
| Delete invoice 1024 | Trash can |
| Close dialog | X |
Notice the fourth row: when the same action applies to different items, include the item in the name. “Delete” repeated five times in a table gives a screen-reader user five identical choices; “Delete invoice 1024” gives five different ones. The same rule applies to navigation: “Settings” is a destination, “gear” is a shape.
Where does the name live? On the control, not on the SVG. Put aria-label on the <button> or use visible text inside it, and hide the decorative SVG with aria-hidden="true". If the visible label already says “Download SVG”, do not add a second aria-label saying the same thing — the button already has its name from the text. A tooltip is not a name: a title attribute is inconsistently announced and never visible to keyboard users until hover, so treat it as a hint, never as the only label.
Pressed, expanded and disabled states in practice
Many icon buttons change state, and each state needs to be communicated, not just painted. A favorite toggle is the classic example:
<button type="button" aria-label="Save to favorites" aria-pressed="false">
<svg aria-hidden="true" viewBox="0 0 24 24">…</svg>
</button>
When the user activates it, flip aria-pressed to "true" and change the accessible name if the action changes — for example to “Remove from favorites”. Keep the attribute and the visual treatment in sync: if the code says pressed but the icon still looks inactive, a sighted keyboard user and a screen-reader user will disagree about the state of the page.
The same pattern applies to disclosure controls (aria-expanded on the button that opens a menu or panel) and to controls that are temporarily unavailable. A disabled button should use the native disabled attribute rather than a grey color alone, because color does not stop a keyboard user from reaching the control and wondering why nothing happens. If you must keep a disabled control focusable to explain why it is unavailable, use aria-disabled="true" and explain the reason in nearby text.
Common mistakes checklist
- A div with a click handler instead of a button. A
<div onclick>has no keyboard semantics, no focus outline and no role. Use a real<button>for actions and a real<a href>for navigation. - An icon-only button with no name. The screen reader announces “button” and nothing else. Give every icon-only control an
aria-labelthat names the action. - The SVG is announced separately. If the SVG is not hidden with
aria-hidden="true", some screen readers announce the graphic as well as the button, producing noise like “Download SVG, image, button”. - State shown only by color. A red heart and a grey heart look identical to someone who cannot distinguish the colors. Pair color with a filled-versus-outline change, a label change, or
aria-pressed. - A 16px click target. WCAG 2.2 asks for a minimum target of 24×24 CSS pixels, and 44×44 is the comfortable recommendation. Keep the artwork small and the button generous — see the icon sizing guide for a worked example.
- Hover-only help. A tooltip that appears only on mouse hover is invisible to touch users and to keyboard users. Put the explanation in visible text, in the accessible name, or behind an explicit control.
Run through this list once per component, not once per page: a toolbar with six icon buttons has six chances to make the same mistake. The SVG accessibility guide covers the markup patterns for decorative, informative and interactive icons, and the icon QA checklist turns these checks into a release gate.