Skip to content

Commit 6271c7f

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Honor scroll margin of host when we're scrolling to a chrome-only-access element.
Differential Revision: https://phabricator.services.mozilla.com/D124691 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1729292 gecko-commit: c1f8d56ba2aa94d5269f1dc26bec79fe5fe83627 gecko-reviewers: smaug
1 parent 502445e commit 6271c7f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<title>scroll-margin on input widget</title>
3+
<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
4+
<link rel="author" href="https://mozilla.org" title="Mozilla">
5+
<link rel="help" href="https://www.w3.org/TR/css-scroll-snap-1/#scroll-margin">
6+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1729292">
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
<style>
10+
#target {
11+
scroll-margin-top: 200px;
12+
}
13+
.padding {
14+
height: 5000px;
15+
}
16+
</style>
17+
18+
<div id="container">
19+
<div class="padding"></div>
20+
<input type="date" id="target">
21+
<div class="padding"></div>
22+
</div>
23+
24+
<script>
25+
test(function() {
26+
document.scrollingElement.scrollTo(0, 20000);
27+
document.getElementById("target").focus();
28+
// Should be around 4900 (5000 - 200px of margin). Give some leeway to account for line height / borders / input padding / etc.
29+
assert_between_exclusive(document.scrollingElement.scrollTop, 4750, 4850, "Should honor date input scroll-margin");
30+
});
31+
</script>

0 commit comments

Comments
 (0)