Content · Web Development · HTML

HTML Icon-Only Buttons: Accessible Names

Icon-Only Buttons: Accessible Names: Try moving through the elements with a keyboard. The labels and relationships matter even when no extra styling has been added. Includes a practical HTML example and an explanation.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Not everyone uses a mouse to explore a website. Good HTML must also make sense through a keyboard or screen reader.

What You Need to Know


A control with no visible text still needs an accessible name. A short aria-label can name a close or search button, but it should describe the action and not contradict any visible label.

Try the Example


Take a look at the example. We’ll explain the important lines right below it.

<button type="button" aria-label="Close message">
    <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
        <path d="M3 3 L13 13 M13 3 L3 13" stroke="currentColor" stroke-width="2" />
    </svg>
</button>

Let’s Read the Code


  • <button>: The button offers an action; its type or command determines what happens.
  • <svg>: Inline SVG describes shapes directly in the page.
  • type: Type changes what sort of control or resource the browser uses.
  • aria-label: Aria-label supplies an accessible name when a visible one is not available.

Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.

What Happens in the Browser?


Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.

What does assistive technology receive? The example includes aria-label, aria-hidden. These relationships can explain names, states, or descriptions when used correctly. They do not automatically move focus, listen for clicks, or create keyboard handling.

Your Turn


Use Tab and Shift+Tab to visit the controls, then read their labels aloud. Is the purpose of each one clear?

Common Beginner Mistakes


  • Judging the page only by how it looks, without checking its meaning and keyboard behavior.
  • ARIA changes what assistive technology is told; it does not automatically add keyboard controls, visual styling, or JavaScript behavior.

Key Takeaways


  • A control with no visible text still needs an accessible name.
  • <button>: The button offers an action; its type or command determines what happens.
  • A meaningful HTML element is usually a stronger starting point than adding an ARIA role to a generic div. Also check what happens using only the keyboard.
Share this resourceSend this page to someone who may find it useful.