<!DOCTYPE HTML>
<script src="../resources/gc.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<!--
Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/gh-pages/explainer.md
Spec: https://wicg.github.io/aom/spec/
-->
<script>
test(function(t) {
assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);
}, "Make sure that Accessibility Object Model is enabled");
</script>
<div role="listbox" id="listbox" tabindex=0>
<div role="option" id="option1">Option 1</div>
<div role="option" id="option2">Option 2</div>
<div role="option" id="option3">Option 3</div>
</div>
<script>
test(function(t) {
var listbox = document.getElementById("listbox");
var option1 = document.getElementById("option1");
listbox.focus();
var axListbox = accessibilityController.accessibleElementById("listbox");
var axOption1 = accessibilityController.accessibleElementById("option1");
assert_false(axOption1.isSelected);
assert_equals(axListbox.ariaActiveDescendantElement(), undefined);
listbox.accessibleNode.activeDescendant = option1.accessibleNode;
assert_equals(axListbox.ariaActiveDescendantElement(), undefined);
// Previously, Active Descendant also makes the option selected. This check
// is here to verify that this no longer happens now that AccessibleNode is
// becoming uncoupled from the Accessibility Tree.
assert_false(axOption1.isSelected);
}, "AccessibleNode.activeDescendant");
</script>