cfleizach@apple.com | ac1945a | 2021-02-04 22:33:13 +0000 | [diff] [blame] | 1 | <!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.org | 31d440a | 2022-02-03 06:36:08 +0000 | [diff] [blame] | 33 | if (accessibilityController.platformName == "atspi") { |
lmoura@igalia.com | 5134aa0a | 2021-02-10 08:53:20 +0000 | [diff] [blame] | 34 | shouldBe("button.title", "'AXTitle: BUTTON'"); |
| 35 | } else { |
| 36 | shouldBe("button.description", "'AXDescription: BUTTON'"); |
| 37 | } |
cfleizach@apple.com | ac1945a | 2021-02-04 22:33:13 +0000 | [diff] [blame] | 38 | |
| 39 | button = accessibilityController.accessibleElementById("button"); |
lmoura@igalia.com | 5134aa0a | 2021-02-10 08:53:20 +0000 | [diff] [blame] | 40 | |
carlosgc@webkit.org | 31d440a | 2022-02-03 06:36:08 +0000 | [diff] [blame] | 41 | if (accessibilityController.platformName == "atspi") { |
lmoura@igalia.com | 5134aa0a | 2021-02-10 08:53:20 +0000 | [diff] [blame] | 42 | shouldBe("button.title", "'AXTitle: BUTTON'"); |
| 43 | } else { |
| 44 | shouldBe("button.description", "'AXDescription: BUTTON'"); |
| 45 | } |
cfleizach@apple.com | ac1945a | 2021-02-04 22:33:13 +0000 | [diff] [blame] | 46 | |
| 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> |