Skip to content

Add normative text on calculating aria-level, aria-posinset, and aria-setsize #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion accname/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ <h4>Computation steps</h4>
<li id="comp_host_language_label">
<span id="step2E"><!-- Don't link to this legacy numbered ID. --></span><em>Host Language Label:</em> Otherwise, if the <code>current node</code>'s native markup provides an
[=attribute=] (e.g. <code>alt</code>) or [=element=] (e.g. HTML <code>label</code> or SVG <code>title</code>) that defines a text alternative, return that alternative in the form of
a <code>flat string</code> as defined by the host language, unless the <code>current node</code> is exposed as presentational (<code>role="presentation"</code> or <code>role="none"</code>).
a <code>flat string</code> as defined by the host language, unless the <code>current node</code> is exposed as presentational (<code>role="presentation"</code> or
<code>role="none"</code>).
<div class="note">
See <a href="https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation">HTML-AAM</a>,
<a href="https://www.w3.org/TR/svg-aam-1.0/#mapping_additional_nd">SVG-AAM</a>, or other host language documentation for more information on markup that defines a text alternative.
Expand Down
53 changes: 49 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14398,10 +14398,10 @@ <h2>Definitions of States and Properties (all aria-* attributes)</h2>
container, restricting this to leaf nodes ensures that there is a single way for <a>assistive technologies</a> to use the attribute.
</p>
<p>
If the <abbr title="Document Object Model">DOM</abbr> ancestry accurately represents the level, the <a>user agent</a> can calculate the level of an item from the document structure. This
attribute can be used to provide an explicit indication of the level when that is not possible to calculate from the document structure or the <pref>aria-owns</pref> attribute. User
agent support for automatic calculation of level might vary; authors SHOULD test with [=user agents=] and assistive technologies to determine whether this attribute is needed. If the
author intends for the user agent to calculate the level, the author SHOULD omit this attribute.
If the <abbr title="Document Object Model">DOM</abbr> ancestry accurately represents the level, the <a>user agent</a> can calculate the level of an item from the document structure as
defined in the <a href="#tree_groups">Calculating Group Position</a> section. This attribute can be used to provide an explicit indication of the level when that is not possible to
calculate from the document structure or the <pref>aria-owns</pref> attribute. User agent support for automatic calculation of level might vary; authors SHOULD test with [=user agents=]
and assistive technologies to determine whether this attribute is needed. If the author intends for the user agent to calculate the level, the author SHOULD omit this attribute.
</p>
<p class="note">
In the case of a <rref>treegrid</rref>, <pref>aria-level</pref> is supported on elements with the role <rref>row</rref>, not elements with role <rref>gridcell</rref>. At first glance,
Expand Down Expand Up @@ -14948,6 +14948,7 @@ <h2>Definitions of States and Properties (all aria-* attributes)</h2>
When specifying <code>aria-posinset</code> on a <rref>menuitem</rref>, <rref>menuitemcheckbox</rref>, or <rref>menuitemradio</rref>, authors SHOULD set the value of
<code>aria-posinset</code> with respect to the total number of items in the <rref>menu</rref>, excluding any separators.
</p>
<p>If <code>aria-posinset</code> is not specified by the author, user agents MUST compute it as defined in the <a href="#tree_groups">Calculating Group Position</a> section.</p>
</div>
<table class="def">
<caption>
Expand Down Expand Up @@ -15748,6 +15749,7 @@ <h2>Definitions of States and Properties (all aria-* attributes)</h2>
When specifying <code>aria-setsize</code> on a <rref>menuitem</rref>, <rref>menuitemcheckbox</rref>, or <rref>menuitemradio</rref>, authors SHOULD set the value of
<code>aria-setsize</code> based on the total number of items in the <rref>menu</rref>, excluding any separators.
</p>
<p>If <code>aria-posinset</code> is not specified by the author, user agents MUST compute it as defined in the <a href="#tree_groups">Calculating Group Position</a> section.</p>
<p>The following example shows items 5 through 8 in a set of 16.</p>
<pre class="example highlight">
&lt;h2 id="label_fruit"&gt; Available Fruit &lt;/h2&gt;
Expand Down Expand Up @@ -16230,6 +16232,49 @@ <h2>Relationships in the Accessibility Tree</h2>
&lt;/div&gt;
</pre
>
<section id="tree_groups">
<h3>Calculating Group Position in the Accessibility Tree</h3>
<p>
When <pref>aria-level</pref>, <pref>aria-posinset</pref>, or <pref>aria-setsize</pref> are defined on supported roles, they allow authors to override the default group position and level
calculation. When those attributes are not specified by the author, user agents MUST compute them following the rules in this section.
</p>
<p>
If <pref>aria-level</pref> is not specified on <rref>comment</rref>, <rref>row</rref> within a <rref>treegrid</rref>, or <rref>treeitem</rref>, user agents MUST compute the level as
follows:
</p>
<ul>
<li>
Walk up the accessibility tree, and count the number of accessibility ancestors with the relevant grouping role. Those roles are as follows:
<ul>
<li>For <rref>comment</rref>, count the number of ancestors with role <rref>comment</rref>.</li>
<li>For <rref>row</rref> within a <rref>treegrid</rref>, count the number of ancestors within the same <rref>treegrid</rref> with role <rref>rowgroup</rref>.</li>
<li>For <rref>treeitem</rref>, count the number of ancestors within the same <rref>tree</rref> with role <rref>group</rref>.</li>
</ul>
</li>
<li>Return 1 + the number of ancestors with the relevant grouping role.</li>
</ul>
<p>
If <pref>aria-posinset</pref> or <pref>aria-setsize</pref> is not specified on any role the supports it with the exception of <rref>article</rref>, user agents MUST compute them as
follows:
</p>
<ul>
<li>
For <rref>treeitem</rref> and <rref>comment</rref>: walk the accessibility tree backward and forward until the explicit or computed level becomes less than the current item's level.
Count items only if they are at the same level as the current item.
</li>
<li>For all other supported roles: process the accessibility parent, counting all accessibility children that have the same role.</li>
<li>For <pref>aria-posinset</pref>, return 1 + the number of group items before the current item in the accessibility tree.</li>
<li>For <pref>aria-setsize</pref>, return the total number of group items, including the current item.</li>
</ul>
<p>
If the author provides one or more of <pref>aria-setsize</pref> and <pref>aria-posinset</pref>, it is the author's responsibility to supply them for all elements in the set. User agent
correction of missing values in this case is not defined.
</p>
<p>
<pref>aria-level</pref>, <pref>aria-posinset</pref>, and <pref>aria-setsize</pref> are all 1-based. When the property is not present or is "0", it indicates the property is not computed or
not supported. If any of these properties are specified by the author as either "0" or a negative number, user agents SHOULD use "1" instead.
</p>
</section>
</section>
</section>
<section class="normative" id="host_languages">
Expand Down