tor-browser

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

test_focus_scrollchildframe.html (915B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for using TAB to move focus and scroll into view</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
      8 </head>
      9 <body onload="doTest()">
     10 <p id="display"></p>
     11 <div id="content" style="display: none"></div>
     12 <script>
     13 function doTest() {
     14  document.getElementById("button").focus();
     15  const iframe = document.querySelector("iframe");
     16  is(window.scrollY, 0, "Scrolled position initially 0");
     17  synthesizeKey("KEY_Tab");
     18  is(document.activeElement, iframe, "Focus moved to the iframe");
     19  is(window.scrollY, 0, "Scrolled position remained the same");
     20  SimpleTest.finish();
     21 }
     22 SimpleTest.waitForExplicitFinish();
     23 </script>
     24 <button id="button">B</button><br><iframe style="margin-top:10000px;height:400px"></iframe>
     25 </body>
     26 </html>