diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html b/testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html new file mode 100644 index 0000000000..115b8ff9fb --- /dev/null +++ b/testing/web-platform/tests/css/cssom-view/scrollIntoView-stuck.tentative.html @@ -0,0 +1,52 @@ +<!doctype html> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width,minimum-scale=1"> +<title>CSSOM View - scrollIntoView doesn't consider scroll-padding when target is stuck</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="author" title="Mozilla" href="https://mozilla.org"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview"> +<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-padding"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1795661"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +body { margin: 0 } +:root { overflow: hidden } +#container { + height: 100vh; + overflow: auto; + scroll-padding-top: 100px; +} +#sticky { + position: sticky; + background: Canvas; + top: 0; +} +#content { + height: 500vh; + background-image: linear-gradient(green, purple); +} +</style> +<div id="container"> + <div id="sticky"> + <input type=text> + </div> + <div id="content"></div> +</div> +<script> +let container = document.getElementById("container"); +let sticky = document.getElementById("sticky"); +test(() => { + // Scroll to the bottom. + container.scrollTo(0, 100000); + + let scrollTop = container.scrollTop; + + assert_not_equals(scrollTop, 0, "Should have scrolled"); + + // Focus on the stuck input. We shouldn't scroll up. + sticky.querySelector("input").scrollIntoView(); + + assert_equals(scrollTop, container.scrollTop, "Shouldn't have scrolled"); +}); +</script> |