summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/scroll-margin-editable.html
blob: 713502820d6d189b43c568afd3fcaa41a8f2eda0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
  <link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-margin" />
  <script src="/resources/testdriver.js"></script>
  <script src="/resources/testdriver-actions.js"></script>
  <script src="/resources/testdriver-vendor.js"></script>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/dom/events/scrolling/scroll_support.js"></script>
<body>
  <style>
    html {
      padding: 10rem;
      border-bottom: solid silver 150vh;
    }
    .target {
      scroll-margin-top: 8rem;
      font-size: 2rem;
      border: solid grey 1px;
    }
  </style>
  <div contenteditable class="target" id="target"></div>
  <script>
    promise_test(async (t) => {
      document.addEventListener("scroll", t.unreached_func(
        "document scrolled for already-in-view target."));
      document.getElementById("target").focus();
      await test_driver.send_keys(target, "a");
      await waitForCompositorCommit();
    }, "already-in-view div should not cause a scroll upon focus.");
  </script>
</body>

</html>