Content · Web Development · HTML

HTML Accessible Names: Text, Labels, and aria-label

Accessible Names: Text, Labels, and aria-label: 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

A webpage should make sense even when someone cannot see its colors, pictures, or layout.

What You Need to Know


An accessible name tells someone what a control or image is called. Visible button text and form labels are usually the clearest names. Use aria-label when there is no suitable visible text, not as a replacement for clear labels everywhere.

In this example: correct an unlabeled search button.

Try the Example


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

<form role="search" action="/search" method="get">
    <label for="site-query">Search lessons</label>
    <input id="site-query" name="q" type="search">
    <button type="submit">Search</button>
</form>

Let’s Read the Code


  • name: The name is the key used for the submitted value.
  • <form>: The form groups controls and identifies where submitted data goes.
  • <label>: The label tells people what the input is for. A matching for/id pair makes the label clickable.
  • for: For connects a label or output with a control by ID.

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.

Try a different way of reading. Read only the headings and labels, or navigate through links without looking at the rest of the page. If the page still makes sense, the underlying HTML is probably doing an important part of its job.

Your Turn


Move through the example without a mouse. Read each control name and current state aloud as if describing it to a friend.

Common Beginner Mistakes


  • Expecting ARIA alone to create keyboard behavior or make a control interactive.
  • ARIA changes what assistive technology is told; it does not automatically add keyboard controls, visual styling, or JavaScript behavior.

Key Takeaways


  • An accessible name tells someone what a control or image is called.
  • name: The name is the key used for the submitted value.
  • 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.