Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<meta charset="utf-8">
<title>Focus related events should fire in the correct order</title>
<link rel="author" title="Mu-An Chiou" href="http://muan.co">
<link rel="help" href="https://w3c.github.io/uievents/#events-focusevent-event-order">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<button type="button" id="fromEl">Focus managemnt from button</button>
<button type="button" id="toEl">To button</button>
<script>
setup({single_test: true});
onload = function() {
const from = document.getElementById("fromEl")
const to = document.getElementById("toEl")
from.addEventListener("keydown", event => {
console.log(event);
to.focus()
});
to.addEventListener("click", event => {console.log(event); assert_unreached();});
from.focus();
let actions = new test_driver.Actions()
.keyDown(" ")
.keyUp(" ").send().then(() => setTimeout(done, 100));
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment