focus-inside-hidden-svg-containers-02.html (1457B)
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 <a href="#void" id="start"> 13 <text tabindex='-1' x="10" y="10">start</text> 14 </a> 15 <g x="30" y="10" style="display: none;"> 16 <a href="#void" id="middle"> 17 <text tabindex='-1' x="30" y="10">middle</text> 18 </a> 19 </g> 20 <a href="#void" id="end"> 21 <text tabindex='-1' x="50" y="10">end</text> 22 </a> 23 </svg> 24 25 <script> 26 promise_test(async t => { 27 const start = document.getElementById('start'); 28 const end = document.getElementById('end'); 29 30 start.focus(); 31 assert_equals(document.activeElement, start, "Start element should be focused initially"); 32 33 // Simulate pressing the Tab key 34 await test_driver.send_keys(start, '\uE004'); // '\uE004' is the WebDriver key code for Tab 35 36 // Verify that the focus moved to the end element and middle element is skipped 37 assert_equals(document.activeElement, end, "End element should be focused after pressing Tab"); 38 }, "Hidden SVG Tab focus test"); 39 </script>