summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html')
-rw-r--r--testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html
new file mode 100644
index 0000000000..7c0b381999
--- /dev/null
+++ b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-012.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Tests position fallback change on scroll with anchor and anchored under the same scroll container</title>
+<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#scroll">
+<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
+<link rel="match" href="anchor-scroll-position-try-012-ref.html">
+<style>
+#scroller {
+ position: relative;
+ width: 400px;
+ height: 400px;
+ overflow-y: scroll;
+}
+
+.box {
+ min-height: 100px;
+ width: 100px;
+}
+
+#anchor {
+ anchor-name: --a;
+ background: orange;
+}
+
+#anchored {
+ position: absolute;
+ top: anchor(--a bottom);
+ width: 100px;
+ height: 100px;
+ background: green;
+ position-anchor: --a;
+ position-try-options: --pf;
+}
+
+@position-try --pf {
+ top: auto;
+ bottom: anchor(--a top);
+}
+</style>
+
+<div id="scroller">
+ <div class="box"></div>
+ <div class="box"></div>
+ <div class="box"></div>
+ <div class="box" id="anchor"></div>
+ <div class="box"></div>
+ <div class="box"></div>
+ <div class="box"></div>
+ <div class="box"></div>
+ <div id="anchored"></div>
+</div>
+
+<script>
+requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ scroller.scrollTop = 150;
+ document.documentElement.classList.remove('reftest-wait');
+ });
+});
+</script>
+</html>
+