Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<title>Style visibility tree update test</title>
<link rel="stylesheet" type="text/css"
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
async function doTest() {
// hide parent while child stays visible
let tree =
{ SECTION: [
{ SECTION: [
{ SECTION: [
{ TEXT_LEAF: [] },
] },
] },
] };
testAccessibleTree("t1_container", tree);
let p = waitForEvents([[EVENT_HIDE, getNode("t1_parent")],
[EVENT_SHOW, getNode("t1_child")],
[EVENT_REORDER, getNode("t1_container")]]);
getNode("t1_parent").style.visibility = "hidden";
await p;
tree =
{ SECTION: [
{ SECTION: [
{ TEXT_LEAF: [] },
] },
] };
testAccessibleTree("t1_container", tree);
// hide grand parent while its children stay visible
tree =
{ SECTION: [ // container
{ SECTION: [ // grand parent
{ SECTION: [
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
{ SECTION: [ // child2
{ TEXT_LEAF: [] },
] },
] },
] },
] };
testAccessibleTree("t2_container", tree);
p = waitForEvents([[EVENT_HIDE, getNode("t2_grandparent")],
[EVENT_SHOW, getNode("t2_child")],
[EVENT_SHOW, getNode("t2_child2")],
[EVENT_REORDER, getNode("t2_container")]]);
getNode("t2_grandparent").style.visibility = "hidden";
await p;
tree =
{ SECTION: [ // container
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
{ SECTION: [ // child2
{ TEXT_LEAF: [] },
] },
] };
testAccessibleTree("t2_container", tree);
// change container style, hide parents while their children stay visible
tree =
{ SECTION: [ // container
{ SECTION: [ // parent
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
] },
{ SECTION: [ // parent2
{ SECTION: [ // child2
{ TEXT_LEAF: [] },
] },
] },
] };
testAccessibleTree("t3_container", tree);
p = waitForEvents([[EVENT_HIDE, getNode("t3_parent")],
[EVENT_HIDE, getNode("t3_parent2")],
[EVENT_SHOW, getNode("t3_child")],
[EVENT_SHOW, getNode("t3_child2")],
[EVENT_REORDER, getNode("t3_container")]]);
getNode("t3_container").style.color = "red";
getNode("t3_parent").style.visibility = "hidden";
getNode("t3_parent2").style.visibility = "hidden";
await p;
tree =
{ SECTION: [ // container
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
{ SECTION: [ // child2
{ TEXT_LEAF: [] },
] },
] };
testAccessibleTree("t3_container", tree);
// change container style and make visible child inside the table
tree =
{ SECTION: [
{ TABLE: [
{ ROW: [
{ CELL: [] },
] },
] },
] };
testAccessibleTree("t4_container", tree);
p = waitForEvents([[EVENT_SHOW, getNode("t4_child")],
[EVENT_REORDER, getNode("t4_child").parentNode]]);
getNode("t4_container").style.color = "red";
getNode("t4_child").style.visibility = "visible";
await p;
tree =
{ SECTION: [
{ TABLE: [
{ ROW: [
{ CELL: [
{ SECTION: [
{ TEXT_LEAF: [] },
] },
] },
] },
] },
] };
testAccessibleTree("t4_container", tree);
// hide subcontainer while child inside the table stays visible
tree =
{ SECTION: [ // container
{ SECTION: [ // subcontainer
{ TABLE: [
{ ROW: [
{ CELL: [
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
] },
] },
] },
] },
] };
testAccessibleTree("t5_container", tree);
p = waitForEvents([[EVENT_HIDE, getNode("t5_subcontainer")],
[EVENT_SHOW, getNode("t5_child")],
[EVENT_REORDER, getNode("t5_container")]]);
getNode("t5_subcontainer").style.visibility = "hidden";
await p;
tree =
{ SECTION: [ // container
{ SECTION: [ // child
{ TEXT_LEAF: [] },
] },
] };
testAccessibleTree("t5_container", tree);
// hide subcontainer while its child and child inside the nested table
// stays visible
tree =
{ SECTION: [ // container
{ SECTION: [ // subcontainer
{ TABLE: [
{ ROW: [
{ CELL: [
{ TABLE: [ // nested table
{ ROW: [
{ CELL: [
{ SECTION: [ // child
{ TEXT_LEAF: [] } ]} ]} ]} ]} ]} ]} ]},
{ SECTION: [ // child2
{ TEXT_LEAF: [] } ]} ]} ]};
testAccessibleTree("t6_container", tree);
p = waitForEvents([[EVENT_HIDE, getNode("t6_subcontainer")],
[EVENT_SHOW, getNode("t6_child")],
[EVENT_SHOW, getNode("t6_child2")],
[EVENT_REORDER, getNode("t6_container")]]);
getNode("t6_subcontainer").style.visibility = "hidden";
await p;
tree =
{ SECTION: [ // container
{ SECTION: [ // child
{ TEXT_LEAF: [] } ]},
{ SECTION: [ // child2
{ TEXT_LEAF: [] } ]} ]};
testAccessibleTree("t6_container", tree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Develop a way to handle visibility style"
Mozilla Bug 606125
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- hide parent while child stays visible -->
<div id="t1_container">
<div id="t1_parent">
<div id="t1_child" style="visibility: visible">text</div>
</div>
</div>
<!-- hide grandparent while its children stay visible -->
<div id="t2_container">
<div id="t2_grandparent">
<div id="t2_parent">
<div id="t2_child" style="visibility: visible">text</div>
<div id="t2_child2" style="visibility: visible">text</div>
</div>
</div>
</div>
<!-- change container style, hide parents while their children stay visible -->
<div id="t3_container">
<div id="t3_parent">
<div id="t3_child" style="visibility: visible">text</div>
</div>
<div id="t3_parent2">
<div id="t3_child2" style="visibility: visible">text</div>
</div>
</div>
<!-- change container style, show child inside the table -->
<div id="t4_container">
<table>
<tr>
<td>
<div id="t4_child" style="visibility: hidden;">text</div>
</td>
</tr>
</table>
</div>
<!-- hide subcontainer while child inside the table stays visible -->
<div id="t5_container">
<div id="t5_subcontainer">
<table>
<tr>
<td>
<div id="t5_child" style="visibility: visible;">text</div>
</td>
</tr>
</table>
</div>
</div>
<!-- hide subcontainer while its child and child inside the nested table stays visible -->
<div id="t6_container">
<div id="t6_subcontainer">
<table>
<tr>
<td>
<table>
<tr>
<td>
<div id="t6_child" style="visibility: visible;">text</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="t6_child2" style="visibility: visible">text</div>
</div>
</div>
<div id="eventdump"></div>
</body>
</html>