Skip to content

Commit 3efa7de

Browse files
committed
Specify behavior when following a hidden subtree via aria-labelledby or -describedby.
1 parent db44930 commit 3efa7de

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

index.html

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,42 @@ <h4>Computation steps</h4>
249249
<li id="step1">Set the <code>root node</code> to the given element, the <code>current node</code> to the <code>root node</code>, and the <code>total accumulated text</code> to the empty string (""). If the <code>root node</code>'s role prohibits naming, return the empty string ("").</li>
250250
<li id="step2">Compute the text alternative for the <code>current node</code>:
251251
<ol>
252-
<li id="step2A">If the <code>current node</code> is <a class="termref">hidden</a> <strong>and is not</strong> directly referenced by <code>aria-labelledby</code> or <code>aria-describedby</code>, nor directly referenced by a native host language text alternative <a class="termref">element</a> (e.g. <code>label</code> in HTML) or <a class="termref">attribute</a>, return the empty string.
252+
<li id="step2A">If the <code>current node</code> is <a class="termref">hidden</a> <strong>and is</strong>:
253+
<ul>
254+
<li><strong>Not</strong> part of an <code>aria-labelledby</code> or <code>aria-describedby</code> traversal, where the node directy referenced by that relation was hidden.</li>
255+
<li><strong>Nor</strong> part of a native host language text alternative <a class="termref">element</a> (e.g. <code>label</code> in HTML) or <a class="termref">attribute</a> traversal, where the root of that traversal was hidden.</li>
256+
</ul>
257+
Return the empty string.
258+
<div><details>
259+
<summary>Comment:</summary>
260+
<p>It's important to clarify the broad definition of hidden for the purposes of accessible name calculation:
261+
<ul>
262+
<li>Nodes with CSS properties <code>display:none</code>, <code>visibility:hidden</code>, <code>visibility:collapse</code> or <code>content-visibility:hidden</code>: They are considered hidden, as they match the guidelines "not perceivable" and "explicitly hidden".</li>
263+
<li>Nodes with CSS properties <code>opacity:0</code> or <code>filter:opacity(0%)</code>, or similar SVG mechanisms: They are not considered hidden. Text hidden with these methods can still be selected or copied, and user agents still expose it in their accessibility trees.</li>
264+
<li>Nodes with the <code>aria-hidden="true"</code> property: it is considered hidden, matching the "explicitly hidden" guideline.</li>
265+
<li>Nodes hidden off screen or behind another object: they are not considered hidden. They are exposed in the accessibility tree and they can even name on-screen objects.</li>
266+
</ul></p>
267+
</details></div>
253268
<div><details>
254269
<summary>Comment:</summary>
255270
<p>By default, <a class="termref">assistive technologies</a> do not relay hidden information, but an author can explicitly override that and include hidden text as part of the <a class="termref">accessible name</a> or <a class="termref">accessible description</a> by using <code>aria-labelledby</code> or <code>aria-describedby</code>. </p>
256271
</details></div>
272+
<div><details>
273+
<summary>Example:</summary>
274+
<p>The following examples show the meaning of the clause "Not part of an <code>aria-labelledby</code> or <code>aria-describedby</code> traversal, where the node directy referenced by that relation was hidden.".</p>
275+
<p>First, <code>element1</code>'s <a class="termref">accessible name</a> is "hello" because, although <code>element3</code> is hidden, it is part of an <code>aria-labelledby</code> traversal started in <code>element2</code>, which is hidden too.</p>
276+
<pre class="example highlight"><code>&lt;element1 id="el1" role="button" aria-labelledby="el2" /&gt;
277+
&lt;element2 id="el2" class="hidden"&gt;
278+
&lt;element3 id="el3" class="hidden"&gt;hello&lt;/element3&gt;
279+
&lt;/element2&gt;</code>
280+
</pre>
281+
<p>Alternatively, <code>element1</code> has no <a class="termref">accessible name</a> if <code>element3</code> is hidden and it is part of an <code>aria-labelledby</code> traversal started in <code>element2</code>, but <code>element2</code> is not hidden.</p>
282+
<pre class="example highlight"><code>&lt;element1 id="el1" role="button" aria-labelledby="el2" /&gt;
283+
&lt;element2 id="el2"&gt;
284+
&lt;element3 id="el3" class="hidden"&gt;hello&lt;/element3&gt;
285+
&lt;/element2&gt;</code>
286+
</pre>
287+
</details></div>
257288
</li>
258289
<li id="step2B">Otherwise:
259290
<ul>
@@ -272,6 +303,9 @@ <h4>Computation steps</h4>
272303
</ol>
273304
</li>
274305
</ul>
306+
<div><details>
307+
<summary>Comment:</summary>
308+
<p>The result of <a href="#step2B.ii.b">step 2B.ii.b</a> in combination with <a href="#step2A">step 2A</a> means that <a class="termref">user agents</a> MUST include all nodes in the subtree as part of the <a class="termref">accessible name</a> or <a class="termref">accessible description</a>, when the node referenced by <code>aria-labelledby</code> or <code>aria-describedby</code> is hidden.</p>
275309
<div><details>
276310
<summary>Example:</summary>
277311
<p>The following example shows the meaning of the clause "&#8230; and the <code>current node</code> is not already part of an <code>aria-labelledby</code> traversal &#8230;" .</p>

0 commit comments

Comments
 (0)