blob: 45ac84ebd50bf7ade577cfa71fb7fc98c75988a7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="content">
<input type="text" role="combobox" id="combo" aria-owns="list">
<ul id="list" role="listbox">
<li tabindex="0" role="option" id="item1">item1</li>
</ul>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This test makes sure that an ARIA active descendant change does not change focus, because focus should remain in the textfield portion of the combo box.");
if (window.testRunner && window.accessibilityController) {
jsTestIsAsync = true;
document.getElementById("combo").focus();
var combo = accessibilityController.accessibleElementById("combo");
debug("The ComboBox should start out as the focused element.");
shouldBeTrue("combo.isEqual(accessibilityController.focusedElement)");
// When the active descendant changes, we should receive a selected children changed notification.
var list = accessibilityController.accessibleElementById("list");
list.addNotificationListener(function(notification) {
debug("Received notification: " + notification);
if (notification == "AXSelectedChildrenChanged") {
list.removeNotificationListener();
document.getElementById("content").style.visibility = 'hidden';
finishJSTest();
}
});
// After the descendant changes, the combo box should still be the focused object.
document.getElementById("combo").setAttribute("aria-activedescendant", "item1");
debug("\nThe ComboBox should still be the focused element even after the aria-activedescendant was changed.");
shouldBeTrue("combo.isEqual(accessibilityController.focusedElement)");
}
</script>
</body>
</html>