tor-browser

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

focus-tabindex-order-shadow-zero-host-not-set-scrollable.html (1793B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: focus - the sequential focus navigation order with shadow dom and scrollable/non-focusable host</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 style="overflow: scroll">
     15 //    #shadowRoot
     16 //      <div #aboveSlot tabindex=0>
     17 //      <slot #slotAbove tabindex=0>
     18 //        (slotted) <div #slottedAbove tabindex=0>
     19 //      <slot #slotBelow tabindex=0>
     20 //        (slotted) <div #slottedBelow tabindex=0>
     21 //      <div #belowSlot tabindex=0>
     22 // <div #belowHost tabindex=0>
     23 
     24 promise_test(() => {
     25  let elementsInFlatTreeOrder;
     26  let [aboveHost, host, aboveSlot, slotAbove, slottedAbove, slotBelow, slottedBelow, belowSlot, belowHost] =
     27    elementsInFlatTreeOrder = prepareDOM(document.body, false);
     28  setTabIndex(elementsInFlatTreeOrder, 0);
     29  removeTabIndex([host]);
     30  host.style = "overflow: scroll";
     31  resetFocus();
     32  // Focus should move in flat tree order since every one of them has tabindex ==0,
     33  // but doesn't include #slot since it's not rendered and #host since its tabindex is not set
     34  // (but #host is considered as 0 in focus scope navigation, keeping the flat tree order for the shadow root's descendants).
     35  return assertFocusOrder(elementsInFlatTreeOrder.filter(el => (el !== slotAbove && el !== slotBelow && el !== host)));
     36 }, "Order when all tabindex=0 except scrollable host (tabindex not set)");
     37 </script>
     38 </body>