tor-browser

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

focus-tabindex-order-shadow-varying-delegatesFocus.html (1573B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: focus - the sequential focus navigation order with shadow dom that delegates focus and tabindex in shadow tree varies</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <script src="resources/shadow-utils.js"></script>
     10 <body>
     11 <script>
     12 // Structure:
     13 // <div #aboveHost tabindex=0>
     14 // <div #host tabindex=0>
     15 //    #shadowRoot (delegatesFocus)
     16 //      <div #aboveSlot tabindex=0>
     17 //      <slot #slotAbove tabindex=1>
     18 //        (slotted) <div #slottedAbove tabindex=3>
     19 //      <slot #slotBelow tabindex=2>
     20 //        (slotted) <div #slottedBelow tabindex=1>
     21 //      <div #belowSlot tabindex=-1>
     22 // <div #belowHost tabindex=0>
     23 
     24 promise_test(() => {
     25  let elementsInFlatTreeOrder;
     26  let [aboveHost, host, aboveSlot, slotAbove, slottedAbove, slotBelow, slottedBelow, belowSlot, belowHost] = elementsInFlatTreeOrder = prepareDOM(document.body, true);
     27  setTabIndex(elementsInFlatTreeOrder, -1);
     28  setTabIndex([aboveHost, host, aboveSlot, belowHost], 0);
     29  setTabIndex([slotAbove, slottedBelow], 1);
     30  setTabIndex([slotBelow], 2);
     31  setTabIndex([slottedAbove], 3);
     32  resetFocus();
     33  return assertFocusOrder([aboveHost, slottedAbove, slottedBelow, aboveSlot, belowHost]);
     34 }, "Order when tabindex varies and delegatesFocus = true");
     35 </script>
     36 </body>