diff options
Diffstat (limited to 'testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html')
-rw-r--r-- | testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html new file mode 100644 index 0000000000..327040eeee --- /dev/null +++ b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> + +<iframe srcdoc="<input><script>document.querySelector('input').focus();</script>"></iframe> + +<script> +'use strict'; + +promise_test(async () => { + await waitForLoad(window); + let iframe = document.querySelector('iframe'); + assert_equals(document.activeElement, iframe, 'Prereq: IFRAME should be focused'); + + let input = document.createElement('input'); + input.autofocus = true; + document.body.appendChild(input); + + await waitUntilStableAutofocusState(); + assert_equals(document.activeElement, iframe, 'activeElement should not be changed'); + assert_not_equals(document.activeElement, input); +}, 'If topDocument\'s focused area is not topDocument, autofocus is not processed.'); +</script> |