focus-tabindex-order-shadow-zero-host-one.html (1669B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focus - the sequential focus navigation order with shadow dom and all tabindex=0 except host (tabindex=1)</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=1> 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 host.tabIndex = 1; 30 resetFocus(); 31 // Focus should move first to #host because it has tabindex=1, and then to the contents of its scope 32 // (e.g. the contents of its shadow tree) in flat tree order, and then outside to the document scope 33 // again (aboveHost & belowHost). 34 return assertFocusOrder([host, aboveSlot, slottedAbove, slottedBelow, belowSlot, aboveHost, belowHost]); 35 }, "Order when all tabindex=0 except for host, which has tabindex=1"); 36 </script> 37 </body>