tor-browser

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

details-focus-steps.html (1926B)


      1 <!DOCTYPE HTML>
      2 <meta charset="utf-8" />
      3 <title>details content, when opened, should be included in the focus flow</title>
      4 <link rel="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements">
      6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1981724">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/resources/testdriver.js"></script>
     10 <script src="/resources/testdriver-vendor.js"></script>
     11 <script src="/resources/testdriver-actions.js"></script>
     12 
     13 <details id=details open>
     14  <summary id=first>First</summary>
     15  <p>Then <a id=second href="#">Second</a></p>
     16 </details>
     17 Finally <button id=third>Third</button>
     18 
     19 <script>
     20  const tabKey = "\ue004";
     21  const shiftKey = "\uE008";
     22 
     23  promise_test(async (t) => {
     24    details.open = true;
     25    first.focus();
     26    await test_driver.send_keys(first, tabKey);
     27    assert_equals(document.activeElement, second);
     28    await test_driver.send_keys(second, tabKey);
     29    assert_equals(document.activeElement, third);
     30    await new test_driver.Actions().keyDown(shiftKey).keyDown(tabKey).keyUp(tabKey).keyUp(shiftKey).send();
     31    assert_equals(document.activeElement, second);
     32    await new test_driver.Actions().keyDown(shiftKey).keyDown(tabKey).keyUp(tabKey).keyUp(shiftKey).send();
     33    assert_equals(document.activeElement, first);
     34  }, "Focus flows into second when details is open");
     35 
     36  promise_test(async (t) => {
     37    details.open = false;
     38    first.focus();
     39    await test_driver.send_keys(first, tabKey);
     40    assert_equals(document.activeElement, third);
     41    await new test_driver.Actions().keyDown(shiftKey).keyDown(tabKey).keyUp(tabKey).keyUp(shiftKey).send();
     42    assert_equals(document.activeElement, first);
     43  }, "Focus flows into third when details is closed");
     44 </script>