summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusing-steps-prevent-autofocus.html
blob: 4d1e792c1cc9cd1fb69ac886a98b6aa6989404c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!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_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>