[go: nahoru, domu]

blob: 6cae5e1df85696b6d7eeb79477d517f2c336df34 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body id="body">
<div id="content" role="group">
<main id="main" aria-hidden="true">
<video controls="controls"></video>
<select id="select"><option>a</select>
<input type="range">
<input type="data">
<progress></progress>
<ul id="ul"><li>item</li></ul>
<select size="10"><option>a</select>
<img src="resources/cake.png" width="145" height="126" usemap="#map">
<map name="map">
<area shape="rect" coords="0,0,100,100" href="#" alt="cake">
</map>
</main>
<button aria-describedby="main">Do not remove aria-hidden nodes from tree within #main</button>
</div>
<script>
function expectUnignoredChildren(parent, expected_unignored_child_indices) {
for (let i = 0; i < parent.childrenCount; i++) {
let child = parent.childAtIndex(i);
if (expected_unignored_child_indices.includes(i)) {
assert_false(child.isIgnored,
'Child#' + i + ' (' + child.role + ') ignored state: ');
}
else {
assert_true(child.isIgnored,
'Child#' + i + ' (' + child.role + ') ignored state: ');
}
}
}
test(function(t) {
var content = accessibilityController.accessibleElementById("main");
assert_equals(content.childrenCount, 8);
assert_true(content.isIgnored);
expectUnignoredChildren(content, [0, 1, 2, 3, 6]);
document.getElementById("ul").tabIndex = 0;
assert_equals(content.childrenCount, 8,
"Making list focusable should make it unignored");
assert_true(content.isIgnored);
expectUnignoredChildren(content, [0, 1, 2, 3, 5, 6]);
document.getElementById("ul").removeAttribute("tabindex");
assert_equals(content.childrenCount, 8,
"Making list unfocusable should make it ignored again");
assert_true(content.isIgnored);
expectUnignoredChildren(content, [0, 1, 2, 3, 6]);
});
</script>
</body>
</html>