Skip to content

Instantly share code, notes, and snippets.

@jgraham
Created March 24, 2020 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgraham/24f4dd737060e054d204905ff50e1cea to your computer and use it in GitHub Desktop.
Save jgraham/24f4dd737060e054d204905ff50e1cea to your computer and use it in GitHub Desktop.
<!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