blob: 4bd6a7399ae9be86bd148a958d7d909bffcdfefb [file] [log] [blame]
cfleizach@apple.comac1945a2021-02-04 22:33:13 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
4<script src="../resources/js-test-pre.js"></script>
5<script src="../resources/accessibility-helper.js"></script>
6</head>
7
8<body id="body">
9
10<div id="otherbutton" tabindex="0">a</div>
11
12<div aria-hidden="true">
13 <p id="backgroundContent">
14 <div tabindex="0" id="button" role="button" aria-label="BUTTON">test</div>
15 </p>
16</div>
17
18<script>
19 description("This tests that a focusable object inside an aria-hidden is in the hieararchy only after it gains focus.");
20
21 if (window.accessibilityController) {
22 jsTestIsAsync = true;
23
24 // By default, if it doesn't have focus it should be hidden because its inside aria-hidden.
25 var button = accessibilityController.accessibleElementById("button");
26 shouldBeTrue("!button || !button.isValid");
27
28 // Gain focus and this element should be visible to AX.
29 document.getElementById("button").focus();
30
31 setTimeout(function() {
32 button = accessibilityController.focusedElement;
carlosgc@webkit.org31d440a2022-02-03 06:36:08 +000033 if (accessibilityController.platformName == "atspi") {
lmoura@igalia.com5134aa0a2021-02-10 08:53:20 +000034 shouldBe("button.title", "'AXTitle: BUTTON'");
35 } else {
36 shouldBe("button.description", "'AXDescription: BUTTON'");
37 }
cfleizach@apple.comac1945a2021-02-04 22:33:13 +000038
39 button = accessibilityController.accessibleElementById("button");
lmoura@igalia.com5134aa0a2021-02-10 08:53:20 +000040
carlosgc@webkit.org31d440a2022-02-03 06:36:08 +000041 if (accessibilityController.platformName == "atspi") {
lmoura@igalia.com5134aa0a2021-02-10 08:53:20 +000042 shouldBe("button.title", "'AXTitle: BUTTON'");
43 } else {
44 shouldBe("button.description", "'AXDescription: BUTTON'");
45 }
cfleizach@apple.comac1945a2021-02-04 22:33:13 +000046
47 // Lose focus and this element should be hidden again.
48 document.getElementById("otherbutton").focus();
49 setTimeout(function() {
50 button = accessibilityController.accessibleElementById("button");
51 shouldBeTrue("!button || !button.isValid");
52 finishJSTest();
53 }, 1);
54 }, 1);
55 }
56</script>
57<script src="../resources/js-test-post.js"></script>
58</body>
59</html>