Neova高级 SEO 平台

ARIA 角色缺少必需的子角色

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

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

WCAG 1.3.1 要求公开结构。有些角色需要特定的子角色,例如 tablist 中的 tab,否则结构无法传达给屏幕阅读器。

您可以做什么

添加带有所需角色的子元素,或用 aria-owns 把它们关联到父元素。

Neova 为何标记

  • 有些角色只能配合特定子元素使用,例如 tablist 内的 tab、listbox 内的 option。
  • 缺少这些子元素,屏幕阅读器就无法告知共有多少项、选中的是哪一项。
  • WCAG 1.3.1(A 级)要求结构信息能被辅助技术获取。

来源

完整指南

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

What This Check Flags

This is the parent-side mirror of the containment rule. Certain composite roles are required to hold specific child roles: a list must contain listitems, a listbox must contain options, a tablist must contain tabs, a menu must contain menuitems. When a parent declares one of these roles but its required children are missing — or buried behind a wrapper element — the rule fires. The cost: a screen reader announces “list” and then finds nothing to count, so the user hears an empty or malformed widget and can’t navigate it.

The user experience of this failure is peculiarly frustrating. Imagine tabbing to what looks, on screen, like a normal navigation menu. The reader says “menu” — a promise that arrow keys will step through items and it’ll announce how many there are. Then nothing responds, because the elements inside carry the wrong roles and the menu owns zero valid menuitems. The user is left pressing arrow keys against a menu that isn’t really a menu. A container role is a contract; declaring it commits you to supplying the children that make the contract true.

A Real Failing Snippet, and the Fix

The usual cause is a wrapper <div> sitting between the parent role and its would-be children, which severs the direct relationship.

<!-- FAILS: list's children are wrappers, not listitems -->
<ul role="list">
  <div class="row">
    <li role="listitem">Overview</li>
  </div>
  <div class="row">
    <li role="listitem">Pricing</li>
  </div>
</ul>

The list’s direct children are <div class="row">, not listitems, so the required-owned relationship is broken. Remove the wrapper so the children are direct, or move the layout class onto the listitem itself:

<!-- PASSES: listitems are direct children of the list -->
<ul role="list">
  <li role="listitem" class="row">Overview</li>
  <li role="listitem" class="row">Pricing</li>
</ul>

When you genuinely can’t flatten the DOM — a grid framework insists on wrapper rows, say — use aria-owns on the parent to list the child ids explicitly. And a reminder: a plain <ul><li> already carries these roles implicitly, so re-declaring them by hand is often what introduced the bug in the first place.

Required Children for Each Container Role

These are the parent roles the check enforces and the child role each one is required to own.

Container Role Must Contain Typical Widget
list listitem Navigation or content list
listbox option Custom select / autocomplete
tablist tab Tabbed panel header
menu / menubar menuitem Application or nav menu
tree treeitem File explorer / nested nav
grid / treegrid row Data grid
row gridcell / cell Row within a grid

How to Detect It

  1. axe DevTools: the “Certain ARIA roles must contain particular children” violation flags each parent and states the child role it failed to find as a direct descendant.
  2. Lighthouse: run the Accessibility audit; this appears in the ARIA group with the offending container elements listed for you to inspect.
  3. ARIA DevTools / accessibility tree: select the parent in the Accessibility panel and expand it. If its children aren’t the required role, the wrapper is intercepting the relationship.

How to Fix It

  1. Identify the parent role and the child role the violation expects.
  2. Remove any wrapper element sitting directly between the parent and its intended children.
  3. Move layout classes or grid markup onto the child elements themselves rather than an intermediate <div>.
  4. If the wrapper is unavoidable, add aria-owns to the parent referencing the child ids.
  5. Prefer native semantic elements — a real <ul>/<li> or <table> gives you the parent-child roles without any hand-authored ARIA.
  6. Re-scan to confirm the tree now nests correctly.

The recurring villain here, ninety percent of the time, is the layout wrapper. A designer needs each row to be a flex container, so a <div class="row"> slides in between the list and its listitems, and the accessibility tree stops recognizing the items as owned children. The fix is nearly always to push that styling onto the child element itself — the listitem can be the flex container — rather than wrapping it. When the framework genuinely won’t let you flatten the markup, aria-owns is your escape hatch, but reach for it second, not first.

Pair this with its counterpart, certain ARIA roles must be contained by particular parents — the same wrapper bug usually trips both from opposite directions. If your list items are the problem, the structural check on list items being contained in a ul or ol is worth a look too.

FAQ

Do I Even Need role="list" on a <ul>?

Usually not — a <ul> already has the list role. The one time it’s justified is when a CSS reset (list-style:none) causes some browsers to drop the implicit list semantics; re-declaring the roles restores them. But if you add role="list", you must also keep the listitem children direct.

Can a Container Be Empty and Still Pass?

An intentionally empty listbox or menu is generally tolerated because it may be populated dynamically. The failure is specifically a container whose direct children are the wrong role, not zero children.

What Breaks the Relationship Most Often?

Layout wrappers — flex rows, grid cells, or a styling <div> inserted between the parent and its children. The accessibility tree only recognizes required-owned children as direct descendants unless aria-owns says otherwise.

My List Uses display:flex and Now Fails — Coincidence?

Almost certainly not, and it’s the most common trigger there is. Setting display:flex or display:grid on a <ul> can cause some browsers to drop the implicit list semantics, or it nudges developers into adding wrapper rows that sever the parent-child relationship. If a previously-passing list broke right after a layout change, that’s your lead — check whether the CSS stripped the roles or whether a new wrapper element slid between the container and its items.

Does This Affect SEO Directly?

Not through rankings, but broken widget semantics hurt real usability and pull down your accessibility audit score. For the bigger picture see accessibility and SEO.

在您自己的网站上找到它

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

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

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

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

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