focus-tabindex-order-shadow-varying-tabindex.html (1499B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focus - the sequential focus navigation order with shadow dom with varying tabindex values</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=3> 14 // <div #host tabindex=3> 15 // #shadowRoot 16 // <div #aboveSlot tabindex=2> 17 // <slot #slotAbove tabindex=1> 18 // (slotted) <div #slottedAbove tabindex=4> 19 // <slot #slotBelow tabindex=1> 20 // (slotted) <div #slottedBelow tabindex=4> 21 // <div #belowSlot tabindex=2> 22 // <div #belowHost tabindex=3> 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([slotAbove, slotBelow], 1); 29 setTabIndex([aboveSlot, belowSlot], 2); 30 setTabIndex([aboveHost, host, belowHost], 3); 31 setTabIndex([slottedAbove, slottedBelow], 4); 32 resetFocus(); 33 return assertFocusOrder([aboveHost, host, slottedAbove, slottedBelow, aboveSlot, belowSlot, belowHost]); 34 }, "Order with various tabindex values"); 35 </script> 36 </body>