Good accessibility usually starts with clear words and the right HTML elements, not a large amount of extra code.
What You Need to Know
aria-labelledby points to existing text that should name an element. aria-describedby points to extra help, such as instructions or an error. Both work by referencing element IDs; they do not change how the element looks.
In this example: associate a dialog title and hint paragraph.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<h2 id="topics-title">Explore topics</h2>
<nav aria-labelledby="topics-title">
<a href="/html">HTML</a>
<a href="/css">CSS</a>
</nav>
Let’s Read the Code
- <h2>: A heading divides the page into understandable parts.
- <nav>: Navigation elements identify groups of important links.
- id: An id uniquely identifies an element on this page.
- aria-labelledby: Aria-labelledby uses the text of another element as the accessible name.
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-labelledby. 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
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
- aria-labelledby points to existing text that should name an element.
- <h2>: A heading divides the page into understandable parts.
- 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.