Neova高级 SEO 平台

ARIA treeitem 没有可访问名称

在 Neova 中 直接在抓取过程中运行,无需任何设置。

规则最近审核:2026年10月17日 · 指南更新:2026年7月2日

无障碍最佳实践,不是 WCAG 的要求。没有名称的树节点,让使用屏幕阅读器的用户在浏览树结构时无内容可读。

您可以做什么

在树节点内添加文本,或为其设置 aria-label 或 aria-labelledby。

Neova 为何标记

  • 没有名称的树节点,在屏幕阅读器用户浏览树时读不出任何内容。
  • 节点不发声时,导航树和文件浏览器就无法使用。
  • 这是 ARIA Authoring Practices 中的最佳实践,本身不是 WCAG 要求。

来源

完整指南

这一部分目前只有英文版。

TL;DR: Every element with role="treeitem" needs an accessible name from visible text, aria-label, or aria-labelledby. Without one, a screen reader announces an anonymous "tree item" and your whole tree widget turns into a guessing game. The fix is usually one attribute, or un-hiding a label that was already there.
Axe rule
aria-treeitem-name
WCAG mapping
4.1.2 Name, Role, Value
Severity
Serious
Who it hits
Screen reader users
Fix effort
Low, usually one component

What This Check Actually Flags

A tree widget is the file explorer pattern: role="tree" on the container, role="treeitem" on every node, and aria-expanded on the branches that open and close. Documentation sidebars, category pickers, folder browsers, org charts, and permission managers all lean on it. This check fires when any element carrying role="treeitem" ends up with no accessible name: no readable text content, no aria-label, no aria-labelledby, nothing the browser can hand to assistive technology.

The failure is invisible in a normal browser session, which is exactly why it survives code review. The node looks fine on screen, the label is right there in pixels. But NVDA or VoiceOver lands on it and announces something like "tree item, 2 of 14, collapsed" and then stops. The user knows a branch exists and where it sits in the list, and has no idea what it is. Multiply that by every node and the whole widget is dead weight for anyone relying on a screen reader.

Why I Treat This as a Blocker, Not a Nice-to-Have

axe-core ships this as the aria-treeitem-name rule and rates it serious. It maps to WCAG success criterion 4.1.2, Name, Role, Value: the moment you claim a role, you owe assistive technology a name to go with it. A control that announces its role but not its identity is arguably worse than a plain div, because it promises interaction it cannot explain.

There is a practical SEO angle too. Trees almost always hold navigation, and the same build mistakes that strip names from the accessibility tree, icon fonts as the only content, empty shells hydrated after load, labels tucked behind aria-hidden, also hand crawlers weak or empty anchor text. Every time I have traced this issue in an audit, the root cause was a rendering or templating problem worth fixing on its own merits. It also drags down the Lighthouse accessibility score that stakeholders actually look at, and unnamed interactive controls are exactly the kind of finding accessibility complaints and demand letters get built on.

What the screen reader announces Before: no accessible name icon only, no text "tree item, 1 of 3, collapsed" Which one? No way to tell. After: named nodes Invoices Receipts Contracts "Invoices, tree item, 1 of 3, collapsed" Clear identity, position, and state.

How a Treeitem Gets Its Name, and How It Loses It

Browsers compute an accessible name in a strict order: aria-labelledby wins, then aria-label, then the element's own text content. That sounds hard to fail, yet teams manage it in very predictable ways:

  • Icon-only nodes. The node is a folder glyph with no text, and nobody added a label attribute.
  • aria-hidden on the label. A wrapper span carries aria-hidden="true", usually copy-pasted from an icon element, and it removes the visible text from name computation.
  • Icon fonts and CSS-injected content. The visible "label" is a glyph painted by CSS. What reaches the accessibility tree is a meaningless private-use character, or nothing at all.
  • Virtualized lists. The framework renders placeholder shells for scroll performance and fills them in later. Both audits and real users catch the empty state.
  • Truncation scripts. Long labels get moved into a title attribute or a tooltip component, and the node itself is left hollow.

Choosing the Right Naming Method

Method How It Works Best For Watch Out For
Visible text content The node's own text becomes the name automatically Almost every tree An aria-hidden wrapper silently erases it
aria-labelledby Points at the id of another element holding the text Names composed from several parts A broken or duplicate id fails with no error
aria-label Hardcoded string on the treeitem itself Icon-only nodes Needs translation and drifts from the visual label
title attribute Last-resort fallback in name computation Nothing, honestly Inconsistent support across screen readers, skip it

How to Detect It

Start with axe DevTools on any page that renders the tree: it flags aria-treeitem-name by name and lists the exact offending nodes. Lighthouse runs axe-core under the hood, so its accessibility category catches this too and slots neatly into CI. For coverage beyond a single page, Screaming Frog (version 20 and up) can run axe accessibility checks during a crawl, which tells you every template that ships the broken component instead of leaving you to play whack-a-mole one URL at a time.

A quick console check works when you just want an answer right now:

[...document.querySelectorAll('[role="treeitem"]')]
  .filter(n => !n.innerText.trim()
    && !n.getAttribute('aria-label')
    && !n.getAttribute('aria-labelledby'))

Then do one manual pass with a real screen reader. NVDA is free on Windows, VoiceOver is built into macOS. Arrow through the tree and listen. Five minutes of that tells you more than any report.

How to Fix It, Step by Step

  1. Inventory the damage. Run axe or the console snippet and identify which component renders the unnamed nodes. It is nearly always one shared component, which makes this a cheap fix with wide reach.
  2. Prefer visible text. Put the label inside the treeitem as real text. Visible text stays in sync with the UI, gets translated with everything else, and never goes stale.
  3. Label icon-only nodes with aria-label that says what the node is, not what the icon looks like: "Invoices", never "folder icon".
  4. Audit aria-hidden. Confirm no wrapper span or ancestor is hiding the label from the accessibility tree. This is the most common silent killer.
  5. Name loading states. If nodes hydrate asynchronously, give the placeholder a name like "Loading" instead of shipping empty shells.
  6. Re-test and lock it in. Verify with axe and a screen reader, then wire the rule into CI so a component refactor cannot quietly reintroduce it.

DO

  • Put the label in real, visible text inside the treeitem whenever possible
  • Use aria-label only for genuinely icon-only nodes
  • Keep aria-expanded on branch nodes so state is announced
  • Test the whole widget with a keyboard plus NVDA or VoiceOver before shipping
  • Add the axe rule to CI so regressions get caught automatically

DON'T

  • Don't wrap the label in aria-hidden="true"
  • Don't rely on an icon font glyph as the node's only content
  • Don't stuff the name into a title attribute and call it done
  • Don't ship placeholder shells with no name during async loading
  • Don't slap role="treeitem" on things that are not trees in the first place

Questions That Come Up

Is This a Hard WCAG Failure or Just a Best Practice?
axe-core classifies aria-treeitem-name as a serious issue mapped to WCAG 4.1.2. Some auditors log it under best practices depending on their methodology, but the user impact is identical either way: an interactive control with no identity. I treat it as a failure and fix it.
Does Fixing This Help Rankings Directly?
No, accessibility conformance is not a documented ranking factor. But the underlying causes, hidden text, empty hydrated shells, icon-only navigation, also degrade what crawlers can extract from your navigation. Fix the component and both audiences win.
Can I Use the Title Attribute as the Accessible Name?
Technically it participates in name computation as a last resort, but screen reader support is inconsistent and it is invisible to touch and keyboard users. Use visible text or aria-label instead.
Should I Even Build a Custom ARIA Tree?
Often no. A nested list with details and summary elements covers most documentation sidebars, is keyboard accessible out of the box, and is far harder to break. The ARIA Authoring Practices tree pattern is for cases that genuinely need selection and full arrow-key semantics.

Unnamed treeitems rarely travel alone.

If one component ships without accessible names, the rest of the template usually has friends. I run a full technical and accessibility crawl and hand you a prioritized fix list your devs can action the same week.

在您自己的网站上找到它

Neova 在每次抓取时都会运行此检查项和其他所有检查项,然后把修复方法写成工单交给您的团队。

  • 适用于 Mac、Windows 和 Linux 的桌面应用
  • 全部 696 项检查,每项都附来源
  • Search Console 和 Analytics 4,以只读方式连接
  • 工单发送到 Jira、Linear 和 Asana

下载 Neova Desktop Free 套餐,或免费试用 Solo 14 天,无需银行卡。

全部无障碍检查 · 指南 · 检查项库

作者:Neova Labs · 返回检查项库