blob: 03179f4a776ed79be9200b62bf7dad6de0aba637 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../../../resources/testharness.js"></script>
<script src="../../../../../resources/testharnessreport.js"></script>
<script src="../../../../../fast/spatial-navigation/resources/snav-testharness.js"></script>
<style>
div {
width: 100px;
height: 100px;
margin: 5px;
border: 1px solid black;
}
</style>
<div id="first" tabindex="0">First</div>
<div id="second" tabindex="0">Second</div>
<div id="third" tabindex="0">Third</div>
<script>
// This test checks that focusless in a11y mode does move focus, but permits
// blurring via the escape key.
let first = document.getElementById("first");
let second = document.getElementById("second");
let third = document.getElementById("third");
test(() => {
snav.triggerMove('Down');
snav.triggerMove('Down'); // Move interest to 'second'
assert_equals(document.activeElement,
second,
"'second' should be focused");
eventSender.keyDown('Escape');
assert_not_equals(document.activeElement,
second,
"Escape key blurs 'second'");
}, "Enter key moves focus into interested element");
</script>