blob: 2e8563f761dd5538185c988dc63008e2ecf25c0c [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/interaction/focus/the-autofocus-attribute/resources/utils.js"></script>
<body>
<dialog></dialog>
<script>
// https://github.com/whatwg/html/issues/4788
promise_test(async () => {
const dialog = document.querySelector('dialog');
dialog.show();
dialog.close();
const input = document.createElement('input');
input.autofocus = true;
document.body.insertBefore(input, dialog);
await waitUntilStableAutofocusState();
assert_equals(document.activeElement, document.body,
'Non-dialog autofocus processing should be skipped.');
}, 'After showing a dialog, non-dialog autofocus processing won\'t work.');
</script>
</body>