Skip to content

Commit

Permalink
Clarify hidden elements do not return name
Browse files Browse the repository at this point in the history
closes #370

Adds comments to label, legend and caption elements to indicate that if they are hidden, then they will not return a name for their associated elements.

Note that right now this means that 
```
<label for=d hidden>foo</label>
<input id=d title=bar>
```
has _no name_.  The label is still referenced, but because it is hidden it returns an empty name in Safari and Chromium browsers.  Firefox correctly returns "bar" as the name of the input.
  • Loading branch information
scottaohara authored Feb 26, 2024
1 parent 3a5bd10 commit 504b34b
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,10 @@ <h4 id=el-caption>`caption`</h4>
<tr>
<th>Comments</th>
<td>
If a descendant of a `table`, the first instance of a `caption` element will provide the `table` its accessible name.
<p class=note>
If a `caption` element is hidden from the accessibility tree, then it will not provide an accessible name
to its parent `table` element.
</p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -2296,7 +2299,7 @@ <h4 id=el-fieldset>`fieldset`</h4>
<span class="type">Role:</span> Use WAI-ARIA mapping
</div>
<div class="relations">
<span class="type">Relations:</span> `IA2_RELATION_LABELLED_BY` with child <a href="#el-legend">`legend`</a> element
<span class="type">Relations:</span> `IA2_RELATION_LABELLED_BY` with first instance of child <a href="#el-legend">`legend`</a> element
</div>
</td>
</tr>
Expand All @@ -2315,7 +2318,7 @@ <h4 id=el-fieldset>`fieldset`</h4>
<span class="type">Role:</span> Use WAI-ARIA mapping
</div>
<div class="relations">
<span class="type">Relations:</span> `ATK_RELATION_LABELLED_BY` with child <a href="#el-legend">`legend`</a> element
<span class="type">Relations:</span> `ATK_RELATION_LABELLED_BY` with first instance of child <a href="#el-legend">`legend`</a> element
</div>
</td>
</tr>
Expand All @@ -2339,6 +2342,10 @@ <h4 id=el-fieldset>`fieldset`</h4>
<tr>
<th>Comments</th>
<td>
<p class=note>
If a `legend` element is hidden from the accessibility tree, then it will not provide an accessible name
to its parent `fieldset` element.
</p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -4972,6 +4979,10 @@ <h4 id=el-label>`label`</h4>
<tr>
<th>Comments</th>
<td>
<p class=note>
If a `label` element is hidden from the accessibility tree, then it will not provide an accessible name
to the labelable element is is associated with.
</p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -7366,25 +7377,34 @@ <h4 id=el-table>`table`</h4>
<tr>
<th><a href="https://msdn.microsoft.com/en-us/library/dd373608%28v=VS.85%29.aspx">MSAA</a> + <a href="http://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/">IAccessible2</a></th>
<td>
Use WAI-ARIA mapping
<div class="role">Use WAI-ARIA mapping</div>
<div class="relations">
<span class="type">Relations:</span> `IA2_RELATION_LABELLED_BY` with first instance of child <a href="#el-caption">`caption`</a> element
</div>
</td>
</tr>
<tr>
<th><a href="https://msdn.microsoft.com/en-us/library/ms726297%28v=VS.85%29.aspx">UIA</a></th>
<td>
Use WAI-ARIA mapping
<div class="role">Use WAI-ARIA mapping</div>
</td>
</tr>
<tr>
<th><a href="https://gnome.pages.gitlab.gnome.org/atk/">ATK</a></th>
<td>
Use WAI-ARIA mapping
<div class="role">Use WAI-ARIA mapping</div>
<div class="relations">
<span class="type">Relations:</span> `ATK_RELATION_LABELLED_BY` with first instance of child <a href="#el-caption">`caption`</a> element
</div>
</td>
</tr>
<tr>
<th><a href="https://developer.apple.com/reference/appkit/nsaccessibility">AX</a></th>
<td>
Use WAI-ARIA mapping
<div class="role">Use WAI-ARIA mapping</div>
<div class="role-namefrom">
<strong>AXDescription:</strong> value from child <a href="#el-caption">`caption`</a> subtree
</div>
</td>
</tr>
<!-- <th><a href="#accessible-name-and-description-computation">Naming Algorithm</a></th> -->
Expand Down

0 comments on commit 504b34b

Please sign in to comment.