author Cosmin Sabou <>
Sun, 05 Feb 2023 19:37:33 +0000
changeset 651812 d8601249f1eb8c52c742b0c19c9ca0fa8f2e31fe
parent 623910 8a52eb5b9043943a168bcfd8aee1bb2b61df4317
permissions -rw-r--r--
Bug 1806090 - temporarily disable browser_quickactions.js on linux for frequent failures. r=intermittent-reviewers,MasterWayZ Differential Revision:

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Re-snapping to the last snapped element on APZ</title>
  <script src="apz_test_utils.js"></script>
  <script src="apz_test_native_event_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
    body {
      margin: 0;
    div {
      position: absolute;
    #scroller {
      width: 100%;
      height: 500px;
      overflow-y: scroll;
      scroll-snap-type: y proximity; /* to escape from the last snap point */
    .child {
      width: 100%;
      height: 100px;
      background-color: blue;
      scroll-snap-align: start;
  <div id="scroller">
    <div class="child" style="top: 0px;"></div>
    <div class="child" style="top: 200px;"></div>
    <div id="spacer" style="width: 100%; height: 2000px;"></div>
  <script type="application/javascript">
    async function test() {
      const proximityThreshold =

      let transformEndPromise = promiseTransformEnd();
      scroller.scrollBy({left: 0, top: 100, behavior: "smooth"});

      await transformEndPromise;
      await promiseApzFlushedRepaints();

      is(scroller.scrollTop, 200, "snap to 200px");

      document.querySelectorAll(".child")[1] = "400px";
      is(scroller.scrollTop, 400, "re-snap to 400px");

      // Now trigger another async scroll to escape from the last snap point.
      transformEndPromise = promiseTransformEnd();
      scroller.scrollBy({left: 0, top: proximityThreshold + 100,
                         behavior: "smooth"});

      // Expand the scrollable region during the async scroll. = "2200px";

      await transformEndPromise;
      await promiseApzFlushedRepaints();

      isnot(scroller.scrollTop, 400, "Do not re-snap to the original 400px point");

    .then(subtestDone, subtestFailed);