tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

helper_zoomToFocusedInput_nested_position_fixed.html (1115B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <meta name="viewport" content="width=device-width, initial-scale=1">
      6  <title>Tests that zoomToFocuedInput doesn't reset the scroll position for nested position:fixed element</title>
      7  <script src="apz_test_native_event_utils.js"></script>
      8  <script src="apz_test_utils.js"></script>
      9  <script src="/tests/SimpleTest/paint_listener.js"></script>
     10  <style>
     11  .container, textarea {
     12    bottom: 10px;
     13    height: 100px;
     14    width: calc(100% - 30px);
     15    position: fixed;
     16  }
     17  html {
     18    height: 500vh;
     19  }
     20  </style>
     21 </head>
     22 <body>
     23 <div class="container">
     24  <textarea></textarea>
     25 </div>
     26 <script>
     27 async function test() {
     28  window.scrollTo(0, document.documentElement.scrollHeight);
     29  const expectedScrollPosition = window.scrollY;
     30 
     31  document.querySelector("textarea").focus();
     32  is(window.scrollY, expectedScrollPosition);
     33 
     34  SpecialPowers.DOMWindowUtils.zoomToFocusedInput();
     35 
     36  await promiseApzFlushedRepaints();
     37 
     38  is(window.scrollY, expectedScrollPosition);
     39 }
     40 
     41 waitUntilApzStable()
     42 .then(test)
     43 .then(subtestDone, subtestFailed);
     44 </script>
     45 </body>
     46 </html>