Skip to content

Clarify Accessibility Parent-Child Relationships for menu, group, and menuitem - #2483

Open
giacomo-petri wants to merge 32 commits into
mainfrom
giacomo-petri-acc-parent-child-menu-widgets
Open

giacomo-petri wants to merge 32 commits into
mainfrom
giacomo-petri-acc-parent-child-menu-widgets

Conversation

@giacomo-petri

@giacomo-petri giacomo-petri commented Mar 21, 2025 •

Copy link
Copy Markdown
Contributor

🚀 Netlify Preview:
🔄 this PR updates the following specs:

Closes #2438

The current specifications for menu and menubar contradict those for menuitem, menuitemcheckbox, and menuitemradio.

Specifically, the following structure is allowed under the menu role but not when considering the menuitem role:

<div role="menu">
	<div role="group">
		<span role="menuitem">Item 1</span>
		<div role="group">
			<span role="menuitem">Item 2</span>
			<span role="menuitem">Item 3</span>
		</div>
	</div>
</div>

This PR clarifies that this structure is indeed allowed.

Additionally, it explicitly clarifies in a note that the following example, where a group contains a button and an input as accessibility children, is not permitted. This prevents ambiguity by making it clear that having at least one menuitem as an accessibility child of the group does not justify including other unrelated elements, which was not clearly stated.

<div role="menu">
	<div role="group">
		<span role="menuitem">Item 1</span>
		<div role="group">
			<span role="menuitem">Item 2</span>
			<span role="menuitem">Item 3</span>
		</div>
		<button>Test</button>
		<input type="text aria-label="Test">
	</div>
</div>

This update refines the specifications for menu, menubar, menuitem, menuitemcheckbox, and menuitemradio roles consistently.


Test, Documentation and Implementation tracking

Once this PR has been reviewed and has consensus from the working group, tests should be written and issues should be opened on browsers. Add N/A and check when not applicable.

  • "author MUST" tests:
  • "user agent MUST" tests:
  • Browser implementations (link to issue or commit):
    • WebKit:
    • Gecko:
    • Blink:
  • Does this need AT implementations?
  • Related APG Issue/PR:
  • MDN Issue/PR:

Preview | Diff

@netlify

netlify Bot commented Mar 21, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for wai-aria ready!

Name Link
🔨 Latest commit 7e2e53b
🔍 Latest deploy log https://app.netlify.com/projects/wai-aria/deploys/6acf5ba12690bd34497a1632
😎 Deploy Preview https://deploy-preview-2483--wai-aria.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkra pkra added the clarification clarifying or correcting language that is either confusing, misleading or under-specified label Mar 21, 2025
Comment thread index.html Resolved
Comment thread index.html Resolved
pkra
pkra previously requested changes Mar 21, 2025
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
giacomo-petri and others added 4 commits March 21, 2025 20:53
Co-authored-by: Peter Krautzberger <p.krautzberger@gmail.com>
Co-authored-by: Peter Krautzberger <p.krautzberger@gmail.com>
@giacomo-petri
giacomo-petri requested a review from pkra March 21, 2025 20:14
@giacomo-petri
giacomo-petri dismissed pkra’s stale review March 21, 2025 20:14

suggestions applied

Comment thread index.html Resolved
@spectranaut

Copy link
Copy Markdown
Contributor

@np-at to review as well!

@scottaohara
scottaohara removed their request for review March 27, 2025 17:27
@scottaohara

Copy link
Copy Markdown
Member

actually, taking myself off as a reviewer since we have so many others.

@giacomo-petri

Copy link
Copy Markdown
Contributor Author

@pkra, I just realized the same issue affects tree/group/treeitem structures. Should we include this change in this PR or create a separate one?

@pkra

pkra commented Apr 3, 2025

Copy link
Copy Markdown
Member

@giacomo-petri sounds good. Hopefully it's simpler since #2094 prevents group as child of tree.

…weaks

* We agreed on introducing the def of "intervening role" later on, but the missing definition causes ambiguity. Therefore, I introduced the "intervening role" concept in the Allowed Accessibility Child Roles and Required Accessibility Parent Role sections.
* Use it for group in menu and menubar.
* Some editorial fixes (typos and similar).
@github-actions
github-actions Bot temporarily deployed to pull request October 2, 2026 08:42 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request October 2, 2026 09:13 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request October 2, 2026 09:27 Inactive
@giacomo-petri

Copy link
Copy Markdown
Contributor Author

I've picked this PR up again and tried to make it easier to understand, while also addressing the concerns about the wording raised in some of the previous comments (@pkra, I hope this version is a step forward). Summary of the latest commits:

  • Intervening role: We originally agreed to define "intervening" later on, but without a definition group as intervening role remained ambiguous, so I've introduced it in this PR:

    • allowed accessibility child roles: a role listed as an intervening role is allowed as an accessibility child, and its own accessibility children are also checked against the same list, at every level of nesting. Unlike generic and none, an element with an intervening role remains an accessibility child in the accessibility tree
    • required accessibility parent role: an element can be an accessibility child of an element with an intervening role, provided that the outermost one is an accessibility child of a non-intervening role from the list
    • UA rule in required accessibility parent role is updated accordingly, so that UA behavior does not change (e.g. a menuitem inside a group outside of any menu is still ignored
    • added a valid example with nested groups to the existing examples in allowed accessibility child roles.

    Note: I placed the definition in "Allowed Accessibility Child Roles" because it only affects role constraints, not the accessibility tree. Happy to move it to "Relationships in the Accessibility Tree" if preferred.

  • menu / menubar

    • allowed children now list group as intervening role
    • rewrote the notes and added an example showing that a group containing menuitems still does not allow unrelated children, such as a button.
  • menuitem / menuitemcheckbox / menuitemradio

    • required parent roles now list group as intervening role, replacing the initial verbose group rows, that were creating donut scoping issues. This closes the gap where group > group > menuitem was valid outside of a menu.
  • group

    • following @pkra's feedback, the menu/menubar guidance is now a non-normative note, and the listbox sentence is restored as it is in main.
  • other editorial fixes

@jnurthen
jnurthen removed the request for review from MelSumner October 8, 2026 17:26
@css-meeting-bot

Copy link
Copy Markdown
Member

The ARIA Working Group just discussed Needs Review - Clarify Accessibility Parent-Child Relationships for menu, group, and menuitem.

The full IRC log of that discussion <Zakim> agendum 4 -- -> Needs Review - Clarify Accessibility Parent-Child Relationships for menu, group, and menuitem https://github.com//pull/2483 -- taken up [from agendabot]
<pkra> jamesn: this is a reminder to review. If you have volunteered, please review. If you're interested, please add yourself.
<Daniel> s/I think there will be more info next week./A draft schedule for breakout sessions will be available early next week/
<pkra> giacomo-petri: I've added an intervening role. We had agreed to add it later but it seemed better this way. I've adjusted the definitions. I've updated the role with this.
<pkra> ... this makes it some things easier.
<Daniel> s/the draft schedule should be ready./When the draft schedule is announced, it would be good for people to take a look and communicate to me any conflicts they see for us to try to address them early enough./
<pkra> jamesn: sounds more substantial. Please take another look.
<pkra> ... or let us know if you're unable to.
<pkra> spectranaut_: we may need additional ones.
<pkra> zakim, next item
<Zakim> agendum 5 -- -> Needs Review - Presentational Roles Conflict Resolution - global WAI-ARIA states or properties on inherited presentational roles
<Zakim> ... https://github.com//pull/2237 -- taken up [from agendabot]
<pkra> jamesn: another PR needing review.
<pkra> giacomo-petri: the main point is that I've tried to make the point clearer that UAs must not make them available.
<pkra> q+
<pkra> ... and some other changes.
<giacomo-petri> q+
<jamesn> Ack pkra
<jamesn> Ack giacomo-petri
<pkra> pkra: I just wanted to point out that we had discussed removing presentational inheritance. That might impact this. But it's not even drafted yet.
<pkra> giacomo-petri: some changes are informed by that thinking, too.
<pkra> zakim, next item

@spectranaut spectranaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things. Overall I approve, the language is a bit difficult to read but I don't think we can avoid that -- i think it's accurate and the examples make it clear!

Comment thread index.html
<p>Authors SHOULD use a <code>group</code> to form a logical collection of items in a <a>widget</a>, such as the children of a <rref>treeitem</rref> forming a collection of siblings in a hierarchy.
Authors MAY nest <code>group</code> elements. However, when a <code>group</code> is used in the context of a <rref>listbox</rref>, for example, authors MUST limit its children to <rref>option</rref>
elements. Therefore, proper handling of <code>group</code> by authors and assistive technologies is determined by the context in which it is provided.</p>
<p class="note">In a <rref>menu</rref> or <rref>menubar</rref>, <code>group</code> is an <a>intervening role</a>. Its <a>accessibility children</a> are subject to the same restrictions as the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these needs to be a note, or if can just be another paragraph.

Comment thread index.html Resolved
Comment thread index.html Resolved
giacomo-petri and others added 2 commits October 14, 2026 08:30
Co-authored-by: Valerie Young <spectranaut@igalia.com>
Co-authored-by: Valerie Young <spectranaut@igalia.com>
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 06:32 Inactive

@pkra pkra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewing this from scratch, I'm still concerned about this change.

I find the new terminology difficult and potentially confusing. It only seems to be introduced to clarify something for role group so I'm wondering why we don't clarify it there instead. Given other issues around groupings, I suspect there may be deeper problems (also in implementations) which this new terminology won't address.

Perhaps we need more group-derivatives (like rowgroup). Perhaps it just boils down to the content model discussion. But I think this needs more discussion.

Comment thread index.html Outdated
</p>
<p><a>User agents</a> SHOULD ignore the current role if the role of the <a>accessibility parent</a> is not in this list.</p>
<p>If a role is listed as an <a>intervening role</a>, an element with the current <a>role</a> can be an <a>accessibility child</a> of an element with that intervening role, provided that the
element with the intervening role, or the outermost one if such elements are nested, is itself an accessibility child of an element with a role from this list that is not an intervening role.</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this sentence difficult to follow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finding it difficult to come up with wording that is both precise and clear without making it overly complex.

I’ve split the original sentence into multiple sentences to make the logic easier to follow and reduce the complexity of the wording. I’ve also added examples to illustrate the reasoning.

Hope this helps

Comment thread index.html Outdated
Authors MAY nest <code>group</code> elements. If a section is significant enough to warrant inclusion in the web page's table of contents, the author SHOULD assign it a <a>role</a> of
<rref>region</rref> or a <a href="#landmark_roles">standard landmark role</a>.
</p>
<p>Contrast with <rref>region</rref>, which is a grouping of user interface objects and information that will be included in a page summary or table of contents. If a section is significant enough to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the second sentence added here?

Comment thread index.html
</p>
<p>Contrast with <rref>region</rref>, which is a grouping of user interface objects and information that will be included in a page summary or table of contents. If a section is significant enough to
warrant inclusion in the web page's table of contents, the author SHOULD assign it a <a>role</a> of <rref>region</rref> or a <a href="#landmark_roles">standard landmark role</a>.</p>
<p>Authors SHOULD use a <code>group</code> to form a logical collection of items in a <a>widget</a>, such as the children of a <rref>treeitem</rref> forming a collection of siblings in a hierarchy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This messy paragraph is what this PR is really trying to clean up, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few changes and reordered the content to improve the flow and make the description easier to follow. The intended structure is:

  • what a group is (existing content)
  • why and when authors should use a group (existing content, but as you said it's hard to follow, so I've re-ordered it)
  • when group elements can be nested (new)
  • how group contrasts with region (existing content)
  • a note clarifying which restrictions apply when group acts as an intervening role (new)

Comment thread index.html Outdated
<a href="#mustContain">allowed accessibility child</a> of a <code>list</code>, but it is a valid descendant if it is also a descendant of the <code>list</code>'s
<a href="#mustContain">allowed accessibility child</a> <code>listitem</code>.
</p>
<p>A role listed in the Allowed Accessibility Child Roles as an <dfn data-export="" data-lt="intervening|intervening role|intervening roles">intervening role</dfn> is allowed as an

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think data-lt should include "intervening" since that term is used differently in the spec already.

Comment thread index.html Outdated
<a href="#mustContain">allowed accessibility child</a> <code>listitem</code>.
</p>
<p>A role listed in the Allowed Accessibility Child Roles as an <dfn data-export="" data-lt="intervening|intervening role|intervening roles">intervening role</dfn> is allowed as an
<a>accessibility child</a>, and its own <a>accessibility children</a> are also checked against the same list, as if they were accessibility children of the element whose list is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this sentence difficult to follow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. I've reworded the text into three separate sentences to make the reasoning easier to follow:

  • sentence 1 - allowed role: an element with an intervening role is allowed as an acc child
  • sentence 2 - checking its acc children: its acc children are checked against the same list as the children of the element that allows the intervening role
  • sentence 3 - nesting: the rule also applies when multiple intervening roles are nested

Comment thread index.html
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitem</code> are <a>accessibility children</a> of an element with role <rref>menu</rref>, <rref>menubar</rref>, or an element
with role <rref>group</rref> that is an <a>accessibility child</a> of an element with role <rref>menu</rref> or <rref>menubar</rref>.
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitem</code> have an <a>accessibility ancestor</a> with role <rref>menu</rref> or <rref>menubar</rref>, with only elements of
role <rref>generic</rref>, <rref>group</rref>, and <rref>none</rref> intervening.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good example why I think "intervening role" is possibly confusing. Here, "intervening" is used in the same way it is already used in the spec.

This change also explicitly lists other roles which are permitted as intervening; that's easily confusing and hints at a bigger problem.

Changing from "parent" to "ancestor" here also suggests that the spec's terminology is lacking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkra, I see your point about the terminology.
My intention was to make the rules explicit about which roles can occur between a required parent role and the current role, while ensuring that nested groups do not bypass the required parent role constraints.
Regarding the distinction between "parent" and "ancestor", the intent is to account for cases where the required role is not the direct accessibility parent, but an ancestor reached through one or more nested groups.
I agree that these concerns may point to a broader issue with how the spec expresses these relationships. If we are not happy with it, I believe we need to discuss alternative approaches before making further changes to the terminology or structure

Comment thread index.html
<p>
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitemcheckbox</code> are <a>accessibility children</a> of an element with role <rref>menu</rref>, <rref>menubar</rref>, or an
element with role <rref>group</rref> that is an <a>accessibility child</a> of an element with role <rref>menu</rref> or <rref>menubar</rref>.
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitemcheckbox</code> have an <a>accessibility ancestor</a> with role <rref>menu</rref> or <rref>menubar</rref>, with only

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Comment thread index.html
<p>
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitemradio</code> are <a>accessibility children</a> of an element with role <rref>menu</rref>, <rref>menubar</rref>, or an
element with role <rref>group</rref> that is an <a>accessibility child</a> of an element with role <rref>menu</rref> or <rref>menubar</rref>.
Authors MUST ensure [=elements=] with <a>role</a> <code>menuitemradio</code> have an <a>accessibility ancestor</a> with role <rref>menu</rref> or <rref>menubar</rref>, with only elements

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Comment thread index.html Outdated
<h2>Relationships in the Accessibility Tree</h2>
<p>The following terms are used to describe relationships between <abbr title="Document Object Model">DOM</abbr> elements.</p>
<p>
The <dfn data-export="" data-lt="accessibility ancestor|accessibility ancestors">accessibility ancestors</dfn> of a DOM element are all DOM elements of which the given DOM element is an

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should move below "accessibility parent" and re-use "accessibility descendant".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure which ordering to follow originally, since the definitions were ordered both alphabetically and logically. I've now moved it below accessibility parent so the logical ordering is preserved.

I'm not sure I understand the suggestion to "re-use accessibility descendant" though, since the current definition already uses that term. Could you clarify what you had in mind?

@giacomo-petri

giacomo-petri commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@pkra, thanks for taking another look.

I find the new terminology difficult and potentially confusing.

I agree that if the new terminology makes the rules harder to understand, I need to reconsider how to explain them. However, I'd also like to put this in context, since the current specification is currently inconsistent, with the allowed-child and required-parent rules effectively contradicting each other in the case of nested groups. Is the proposed approach actually worse than the current situation, where the specification effectively says two opposite things?

It only seems to be introduced to clarify something for role group so I'm wondering why we don't clarify it there instead.

The problem is that the current rules for allowed accessibility child roles and required accessibility parent roles are inconsistent for nested groups. Before making further changes, though, I'd like to clarify the problem this PR is trying to address:

  • allow nested groups in menus: structures such as menu > group > group > menuitem should be valid
  • preserve the required parent role constraints: a menuitem should not become valid outside an appropriate menu or menubar context simply because it is nested within one or more group elements
  • keep the allowed-child and required-parent rules consistent: the intended relationships need to be reflected in both sets of normative rules, rather than explained only in the group role description

Clarifying group in isolation would explain the intended use of the role, but would not resolve that inconsistency in the normative rules (menu, menubar, menuitem, menuitemcheckbox, menuitemradio) that authors and implementers rely on.

Perhaps we need more group-derivatives (like rowgroup). Perhaps it just boils down to the content model discussion. But I think this needs more discussion.

I agree that this deserves further discussion, particularly to determine whether the proposed mechanism is the right way to express these relationships or whether a different approach would be more appropriate. I've re-added the agenda label so we can discuss this before making further structural changes.

@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 09:33 Inactive
Restored definition of accessibility ancestors in the document.
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 09:50 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 09:53 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 10:07 Inactive
Clarify conditions for intervening roles and accessibility children in the accessibility parent roles section.
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 10:40 Inactive

This branch was previously deployed

1 inactive deployment
pull request — 7e2e53b3 Deployed Oct 14, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Agenda clarification clarifying or correcting language that is either confusing, misleading or under-specified spec:aria

Projects

Status: Needs updates from review

Development

Successfully merging this pull request may close these issues.

Group as allowed acc child of role menu if acc child of menuitem

7 participants