summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/capturing-snap-positions.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/css/css-scroll-snap/capturing-snap-positions.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/css/css-scroll-snap/capturing-snap-positions.html')
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap/capturing-snap-positions.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/capturing-snap-positions.html b/testing/web-platform/tests/css/css-scroll-snap/capturing-snap-positions.html
new file mode 100644
index 0000000000..7bc96b9d33
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-snap/capturing-snap-positions.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>scroll-snap-type on non-scrollers traps snap positions</title>
+<link rel=author title="Tab Atkins-Bittner" href="https://www.xanthir.com/contact/">
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#captures-snap-positions">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+
+.scroller {
+ width: 100px;
+ height: 100px;
+ overflow: auto;
+ scroll-snap-type: block mandatory;
+}
+.item {
+ background: gray;
+ height: 100px;
+ scroll-snap-type: block mandatory;
+}
+.item.snapped {
+ background: green;
+ scroll-snap-align: center;
+}
+.subitem {
+ background: red;
+ height: 100px;
+ scroll-snap-align: center;
+}
+
+</style>
+
+
+<!--
+Boxes with a non-none value for scroll-snap-type
+will capture snap positions from their descendents,
+preventing them from affecting higher-up scrollers,
+even if they are not, themselves, scrollers.
+-->
+
+<div class=scroller>
+ <div class=item></div>
+ <div class=item><div class=subitem></div></div>
+ <div class="item snapped"></div>
+ <div class=item></div>
+</div>
+
+<script>
+
+test(()=>{
+ const el = document.querySelector('.scroller');
+ assert_equals(el.scrollTop, 200);
+}, "The third item should be snapped to by default, not the second's child.");
+
+</script>