ARIA tree items should have an accessible name
Each element with role="treeitem" should have an accessible name, so users can tell the folders and pages of a tree view apart. This is a best practice, not a WCAG requirement.
| Rule ID | aria-treeitem-name |
|---|---|
| Impact | Serious |
| Success criterion | Best practice, not a WCAG requirement |
| Fixed with a text: from the page or written by AI |
Example
<ul role="tree" aria-label="File manager">
<li role="treeitem" aria-expanded="false" tabindex="0">
<span class="icon-folder"></span>
</li>
</ul>A screen reader says “collapsed, 1 of 1, level 1”, with no folder name.
<ul role="tree" aria-label="File manager">
<li role="treeitem" aria-expanded="false" tabindex="0" aria-label="Invoices 2026">
<span class="icon-folder"></span>
</li>
</ul>A screen reader says “Invoices 2026, collapsed, 1 of 1, level 1”.
Why it matters
Tree views show nested structures: folders in a file manager, chapters in documentation, categories in a shop. Screen reader users move through them with the arrow keys and rely on each item's name to know where they are. An item without a name is announced only by its state and position, so a tree of unnamed folders sounds like a list of identical, empty entries.
Blind users are most affected, followed by voice control users, who cannot say the name of an item to select it. Unnamed items often come from icon-only rows, names drawn into images, or text placed in a separate element that is not linked. This is a best practice rather than a WCAG requirement, but in practice a tree without names is unusable without sight.
How to fix it
Keep the text inside the item. The simplest fix is visible text inside the tree item:
<li role="treeitem" aria-expanded="false">
<span class="icon-folder" aria-hidden="true"></span> Invoices 2026
</li>
Icon-only item. Add an aria-label with the name a sighted user would read, as in the example above.
Name stored in another element. Point aria-labelledby at it, for example when a row shows the name in a separate column.
Parent items. The name of a parent item comes from all the text inside it, including its children. To keep the announcement short, name the parent explicitly:
<li role="treeitem" aria-expanded="true" aria-labelledby="docs-label">
<span id="docs-label">Documents</span>
<ul role="group">…</ul>
</li>
Keep names short and unique at the same level, so users can tell siblings apart. Leave state out of the name: “expanded” and “collapsed” come from aria-expanded, and the level and position are announced automatically. Avoid title as the only name, because it is not shown to touch or keyboard users and some screen readers skip it.
Checklist
- Give every tree item visible text where possible.
- Add aria-label to icon-only tree items.
- Name parent items with aria-labelledby to avoid long announcements.
- Keep sibling names unique.
How the check works
The check looks at every element with role="treeitem". It passes when the item has visible text, a non-empty aria-label, an aria-labelledby that points to text, or a non-empty title. Otherwise it fails. Whether names are meaningful, short and unique still needs a manual review with a screen reader.
Resources
- Tree view pattern W3C WAI
Updated October 27, 2026