Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!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>
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_not_equals(document.activeElement, input,
'Non-dialog autofocus processing should be skipped.');
}, 'After showing a dialog, non-dialog autofocus processing won\'t work.');
</script>
</body>