tor-browser

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

setSequentialFocusStartingPoint.tentative.html (1107B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:jarhar@chromium.org">
      3 <link rel=help href="https://github.com/whatwg/html/issues/5326">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 
      9 <button id=b1>b1</button>
     10 <div id=d1>d1</div>
     11 <button id=b2>b2</button>
     12 
     13 <script>
     14 const tabKey = '\uE004';
     15 promise_test(async () => {
     16  assert_equals(document.activeElement, document.body,
     17    'Focus should initially be set on the body element.');
     18 
     19  document.setSequentialFocusStartingPoint(d1);
     20  assert_equals(document.activeElement, document.body,
     21    'Calling setSequentialFocusStartingPoint should not change the focused element.');
     22 
     23  await test_driver.send_keys(document.activeElement, tabKey);
     24  assert_equals(document.activeElement, b2,
     25    'Pressing tab should focus the next button after the sequential focus starting point.');
     26 }, 'document.setSequentialFocusStartingPoint should set the sequential focus starting point on any element.');
     27 </script>