diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html new file mode 100644 index 0000000000..382addadef --- /dev/null +++ b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss-on-scroll.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<html lang="en"> +<meta charset="utf-8" /> +<title>Popover should *not* light dismiss on scroll</title> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> +<link rel=help href="https://html.spec.whatwg.org/multipage/popover.html"> +<link rel=help href="https://github.com/openui/open-ui/issues/240"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id=scroller> + Scroll me<br><br> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. Enim ut sem viverra aliquet eget sit amet tellus. Massa + sed elementum tempus egestas sed sed risus pretium. Felis bibendum ut tristique et egestas + quis. Tortor dignissim convallis aenean et. Eu mi bibendum neque egestas congue quisque +</div> + +<div popover id=popover1> + This is popover 1 + <div popover id=popover2 anchor=anchor> + This is popover 2 + </div> +</div> +<button onclick='popover1.showPopover();popover2.showPopover();'>Open popovers</button> + +<style> + #popover1 { top:50px; left: 50px; } + #popover2 { top:150px; left: 50px; } + #scroller { + height: 150px; + width: 150px; + overflow-y: scroll; + border: 1px solid black; + } +</style> + +<script> + const popovers = document.querySelectorAll('[popover]'); + function assertAll(showing) { + for(let popover of popovers) { + assert_equals(popover.matches(':popover-open'),showing); + } + } + async_test(t => { + for(let popover of popovers) { + popover.addEventListener('beforetoggle',e => { + if (e.newState !== "closed") + return; + assert_unreached('Scrolling should not light-dismiss a popover'); + }); + } + assertAll(/*showing*/false); + popovers[0].showPopover(); + popovers[1].showPopover(); + assertAll(/*showing*/true); + scroller.scrollTo(0, 100); + requestAnimationFrame(() => { + requestAnimationFrame(() => { + assertAll(/*showing*/true); + t.done(); + }); + }); + },'Scrolling should not light-dismiss popovers'); +</script> |