summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html')
-rw-r--r--testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html b/testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html
new file mode 100644
index 0000000000..c07d313c9e
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/popovers/popover-focus-child-dialog.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<link rel=author href="mailto:jarhar@chromium.org">
+<link rel=help href="https://chromium-review.googlesource.com/c/chromium/src/+/4021969">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div id=popover1 popover>
+ <dialog id=childdialog autofocus>
+ <button autofocus>hello world</button>
+ </dialog>
+</div>
+
+<div id=popover2 popover=manual>
+ <div id=childpopover popover=manual autofocus>
+ <button autofocus>hello world</button>
+ </div>
+</div>
+
+<script>
+test(t => {
+ t.add_cleanup(() => childdialog.close());
+ t.add_cleanup(() => popover1.hidePopover());
+
+ childdialog.showModal();
+ document.activeElement.blur();
+ popover1.showPopover();
+
+ assert_true(popover1.matches(':open'), 'The popover should be open.');
+ assert_true(childdialog.hasAttribute('open'), 'The dialog should be open.');
+ assert_equals(document.activeElement, document.body, 'Nothing should have gotten focused.');
+}, 'Popovers should not initially focus child dialog elements.');
+
+test(t => {
+ t.add_cleanup(() => childpopover.hidePopover());
+ t.add_cleanup(() => popover2.hidePopover());
+
+ childpopover.showPopover();
+ document.activeElement.blur();
+ popover2.showPopover();
+
+ assert_true(popover2.matches(':open'), 'The parent popover should be open.');
+ assert_true(childpopover.matches(':open'), 'The child popover should be open.');
+ assert_equals(document.activeElement, document.body, 'Nothing should have gotten focused.');
+}, 'Popovers should not initially focus child popover elements.');
+</script>