Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Test calling dialog focusing steps in navigable's focus handler</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
</head>
<body>
<iframe id="iframe" srcdoc="<dialog>Hello</dialog>"></iframe>
</body>
<script>
window.onload = function() {
async_test((t) => {
iframe.addEventListener("focus", function() {
const dialog = iframe.contentDocument.body.querySelector("dialog");
dialog.showModal();
// If `lock-for-focus` is implemented, showModal() can't
// trigger the dialog-focusing-steps, hence the activeElement
// shouldn't be the dialog.
assert_equals(iframe.contentDocument.activeElement, dialog);
t.done();
})
iframe.focus();
}, "dialog.focus() in navigable's focus handler");
}
</script>