File: focus-inside-hidden-svg-containers-01.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (33 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tabbing through Non-Rendered SVG elements</title>
<link rel="author" title="Divyansh Mangal" href="mailto:dmangal@microsoft.com">
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#interact-Focus">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<svg xmlns="http://www.w3.org/2000/svg">
  <text tabindex='1' id="start" x="10" y="10">start</text>
  <g x="30" y="10" style="display: none;">
    <text tabindex='2' id="middle" x="30" y="10">middle</text>
  </g>
  <text tabindex='3' id="end" x="50" y="10">end</text>
</svg>

<script>
  promise_test(async t => {
    const start = document.getElementById('start');
    const end = document.getElementById('end');

    start.focus();
    assert_equals(document.activeElement, start, "Start element should be focused initially");

    // Simulate pressing the Tab key
    await test_driver.send_keys(start, '\uE004'); // '\uE004' is the WebDriver key code for Tab

    // Verify that the focus moved to the end element and middle element is skipped
    assert_equals(document.activeElement, end, "End element should be focused after pressing Tab");
  }, "Hidden SVG Tab focus test");
</script>