dialog-focusing-steps-prevent-autofocus.html (773B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/html/interaction/focus/the-autofocus-attribute/resources/utils.js"></script> 5 <body> 6 <dialog></dialog> 7 <script> 8 // https://github.com/whatwg/html/issues/4788 9 promise_test(async () => { 10 const dialog = document.querySelector('dialog'); 11 dialog.show(); 12 dialog.close(); 13 const input = document.createElement('input'); 14 input.autofocus = true; 15 document.body.insertBefore(input, dialog); 16 await waitUntilStableAutofocusState(); 17 assert_not_equals(document.activeElement, input, 18 'Non-dialog autofocus processing should be skipped.'); 19 }, 'After showing a dialog, non-dialog autofocus processing won\'t work.'); 20 </script> 21 </body>