29 lines
986 B
HTML
29 lines
986 B
HTML
<!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>
|
|
// https://github.com/whatwg/html/pull/11182
|
|
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>
|