tor-browser

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

focus-inside-hidden-svg-containers-01.html (1366B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Tabbing through Non-Rendered SVG elements</title>
      4 <link rel="author" title="Divyansh Mangal" href="mailto:dmangal@microsoft.com">
      5 <link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#interact-Focus">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="/resources/testdriver.js"></script>
      9 <script src="/resources/testdriver-vendor.js"></script>
     10 
     11 <svg xmlns="http://www.w3.org/2000/svg">
     12  <text tabindex='1' id="start" x="10" y="10">start</text>
     13  <g x="30" y="10" style="display: none;">
     14    <text tabindex='2' id="middle" x="30" y="10">middle</text>
     15  </g>
     16  <text tabindex='3' id="end" x="50" y="10">end</text>
     17 </svg>
     18 
     19 <script>
     20  promise_test(async t => {
     21    const start = document.getElementById('start');
     22    const end = document.getElementById('end');
     23 
     24    start.focus();
     25    assert_equals(document.activeElement, start, "Start element should be focused initially");
     26 
     27    // Simulate pressing the Tab key
     28    await test_driver.send_keys(start, '\uE004'); // '\uE004' is the WebDriver key code for Tab
     29 
     30    // Verify that the focus moved to the end element and middle element is skipped
     31    assert_equals(document.activeElement, end, "End element should be focused after pressing Tab");
     32  }, "Hidden SVG Tab focus test");
     33 </script>