-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Compute accessible names for hidden/hidden-but-referenced nodes
This change implements full support for the “A. Hidden Not Referenced” step at https://w3c.github.io/accname/#step2A in the “Accessible Name and Description Computation” spec — including handling all hidden nodes that must be ignored, as well as handling hidden nodes that, for the purposes of accessible-name computation, must not be ignored (due to having aria-labelledby/aria-describedby references from other nodes). Otherwise, without this change, not all cases of hidden nodes get ignored as expected, while cases of nodes that are hidden but that have aria-labelledby/aria-describedby references from other nodes get unexpectedly ignored.
- Loading branch information
1 parent
98dadb0
commit ff18f72
Showing
7 changed files
with
478 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_hidden_not_referenced.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 5 tests | ||
|
||
5 Pass | ||
Details | ||
Result Test Name MessagePass button containing a rendered, unreferenced element that is aria-hidden=true, an unreferenced element with the hidden host language attribute, and an unreferenced element that is unconditionally rendered | ||
Pass button labelled by element that is aria-hidden=true | ||
Pass button labelled by element with the hidden host language attribute | ||
Pass link labelled by elements with assorted visibility and a11y tree exposure | ||
Pass heading with name from content, containing element that is visibility:hidden with nested content that is visibility:visible |
37 changes: 37 additions & 0 deletions
37
Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_labelledby_hidden_nodes.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 27 tests | ||
|
||
27 Pass | ||
Details | ||
Result Test Name MessagePass button with aria-labelledby using display:none hidden span (with nested span) | ||
Pass button with aria-labelledby using display:none hidden span (with nested spans, depth 2) | ||
Pass button with aria-labelledby using span without display:none (with nested display:none spans, depth 2) | ||
Pass button with aria-labelledby using display:none hidden span (with nested sibling spans) | ||
Pass button with aria-labelledby using span without display:none (with nested display:none sibling spans) | ||
Pass button with aria-labelledby using span with display:none (with nested display:inline sibling spans) | ||
Pass button with aria-labelledby using visibility:hidden span (with nested span) | ||
Pass button with aria-labelledby using visibility:hidden span (with nested spans, depth 2) | ||
Pass button with aria-labelledby using span without visibility:hidden (with nested visibility:hidden spans, depth 2) | ||
Pass button with aria-labelledby using visibility:hidden hidden span (with nested sibling spans) | ||
Pass button with aria-labelledby using span without visibility:hidden (with nested visibility:hidden sibling spans) | ||
Pass button with aria-labelledby using span with visibility:hidden (with nested visibility:visible sibling spans) | ||
Pass button with aria-labelledby using visibility:collapse span (with nested span) | ||
Pass button with aria-labelledby using visibility:collapse span (with nested spans, depth 2) | ||
Pass button with aria-labelledby using span without visibility:collapse (with nested visibility:visible spans, depth 2) | ||
Pass button with aria-labelledby using visibility:collapse span (with nested sibling spans) | ||
Pass button with aria-labelledby using span without visibility:collapse (with nested visibility:collapse sibling spans) | ||
Pass button with aria-labelledby using span with visibility:collapse (with nested visible sibling spans) | ||
Pass button with aria-labelledby using aria-hidden span (with nested span) | ||
Pass button with aria-labelledby using aria-hidden span (with nested spans, depth 2) | ||
Pass button with aria-labelledby using span without aria-hidden (with nested aria-hidden spans, depth 2) | ||
Pass button with aria-labelledby using aria-hidden hidden span (with nested sibling spans) | ||
Pass button with aria-labelledby using HTML5 hidden span (with nested span) | ||
Pass button with aria-labelledby using HTML5 hidden span (with nested spans, depth 2) | ||
Pass button with aria-labelledby using span without HTML5 hidden (with nested HTML5 hidden spans, depth 2) | ||
Pass button with aria-labelledby using HTML5 hidden span (with nested hidden sibling spans) | ||
Pass button with aria-labelledby using span without HTML5 hidden (with nested hidden sibling spans) |
92 changes: 92 additions & 0 deletions
92
Tests/LibWeb/Text/input/wpt-import/accname/name/comp_hidden_not_referenced.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Name Comp: Hidden Not Referenced</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../../resources/testdriver.js"></script> | ||
<script src="../../resources/testdriver-vendor.js"></script> | ||
<script src="../../resources/testdriver-actions.js"></script> | ||
<script src="../../wai-aria/scripts/aria-utils.js"></script> | ||
</head> | ||
<body> | ||
|
||
<p>Tests the <a href="https://w3c.github.io/accname/#comp_hidden_not_referenced">#comp_hidden_not_referenced</a> portions of the AccName <em>Name Computation</em> algorithm.</p> | ||
|
||
<button | ||
class="ex" | ||
data-expectedlabel="visible to all users" | ||
data-testname="button containing a rendered, unreferenced element that is aria-hidden=true, an unreferenced element with the hidden host language attribute, and an unreferenced element that is unconditionally rendered" | ||
> | ||
<span aria-hidden="true">hidden,</span> | ||
<span hidden>hidden from all users,</span> | ||
<span>visible to all users</span> | ||
</button> | ||
|
||
<button | ||
class="ex" | ||
data-expectedlabel="hidden but referenced," | ||
data-testname="button labelled by element that is aria-hidden=true" | ||
aria-labelledby="button-label-2" | ||
> | ||
<span aria-hidden="true" id="button-label-2">hidden but referenced,</span> | ||
<span hidden>hidden from all users,</span> | ||
<span>visible to all users</span> | ||
</button> | ||
|
||
<button | ||
class="ex" | ||
data-expectedlabel="hidden from all users but referenced," | ||
data-testname="button labelled by element with the hidden host language attribute" | ||
aria-labelledby="button-label-3" | ||
> | ||
<span aria-hidden="true">hidden,</span> | ||
<span hidden id="button-label-3">hidden from all users but referenced,</span> | ||
<span>visible to all users</span> | ||
</button> | ||
|
||
<a | ||
class="ex" | ||
data-testname="link labelled by elements with assorted visibility and a11y tree exposure" | ||
data-expectedlabel="visible to all users, hidden but referenced, hidden from all users but referenced" | ||
href="#" | ||
aria-labelledby="link-label-1a link-label-1b link-label-1c" | ||
> | ||
<span id="link-label-1a"> | ||
<span>visible to all users,</span> | ||
<span aria-hidden="true">hidden,</span> | ||
</span> | ||
<span aria-hidden="true" id="link-label-1b">hidden but referenced,</span> | ||
<span hidden id="link-label-1c">hidden from all users but referenced</span> | ||
</a> | ||
|
||
<h2 | ||
class="ex" | ||
data-testname="heading with name from content, containing element that is visibility:hidden with nested content that is visibility:visible" | ||
data-expectedlabel="visible to all users, un-hidden for all users" | ||
> | ||
visible to all users, | ||
<span style="visibility: hidden;"> | ||
hidden from all users, | ||
<span style="visibility: visible;">un-hidden for all users</span> | ||
</span> | ||
</h2> | ||
|
||
<!-- TODO: Test cases once https://github.com/w3c/aria/issues/1256 resolved: --> | ||
<!-- - button labelled by an element that is aria-hidden=true which contains a nested child that is aria-hidden=false --> | ||
<!-- - button labelled by an element that is aria-hidden=false which belongs to a parent that is aria-hidden=true --> | ||
<!-- - heading with name from content, containing rendered content that is aria-hidden=true with nested, rendered content that is aria-hidden=false --> | ||
<!-- - heading with name from content, containing element with the hidden host language attribute with nested content that is aria-hidden=false --> | ||
|
||
<!-- TODO: New test case? | ||
<!-- What is the expectation for a details element when it’s given an --> | ||
<!-- explicit role that allows name from contents (e.g., `comment`) --> | ||
<!-- but is also not in the open state, and therefore has contents --> | ||
<!-- that are both not rendered and excluded from the a11y tree. --> | ||
|
||
<script> | ||
AriaUtils.verifyLabelsBySelector(".ex"); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.