focus-navigation.html (2288B)
1 <!DOCTYPE html> 2 <meta name="timeout" content="long"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="/resources/testdriver-actions.js"></script> 8 <script src="resources/shadow-dom.js"></script> 9 <script src="resources/focus-utils.js"></script> 10 <div id="log"></div> 11 <p> 12 document tree: [i0 -> [x-foo]]<br> 13 x-foo's shadow tree: [j5 -> [x-bar] -> j6]<br> 14 x-bar's shadow tree: [k1 -> k0 -> [s2]]<br> 15 slot #s2: [j1 -> j2 -> j3 -> j4 -> [s1] -> j0]<br><br> 16 slot #s1: [i1 -> i2]<br> 17 <b>v1 ideal nav forward: [i0 -> j5 -> xbar -> k1 -> k0 -> j1 -> j2 -> j3 -> j4 -> i1 -> i2 -> j0 -> j6]</b><br> 18 </p> 19 20 <input id="i0" tabindex=0 value="i0"> 21 <div id="x-foo"> 22 <input id="i2" slot="s1" tabindex=2 value="i2"> 23 <input id="i1" slot="s1" tabindex=1 value="i1"> 24 <template data-mode="open"> 25 <div id="x-bar" tabindex=4> 26 <input id="j1" slot="s2" tabindex=1 value="j1"> 27 <slot id="s1" name="s1" slot="s2"></slot> 28 <input id="j0" slot="s2" tabindex=0 value="j0"> 29 <input id="j3" slot="s2" tabindex=2 value="j3"> 30 <div id="j4" slot="s2" tabindex=3> 31 <input id="j2" tabindex=1 value="j2"> 32 </div> 33 <template data-mode="open"> 34 <input id="k0" tabindex=0 value="k0"> 35 <slot id="s2" name="s2"></slot> 36 <input id="k1" tabindex=1 value="k1"> 37 </template> 38 </div> 39 <input id="j6" tabindex=4 value="j6"> 40 <input id="j5" tabindex=3 value="j5"> 41 </template> 42 </div> 43 44 <script> 45 'use strict'; 46 47 promise_test(async () => { 48 let xfoo = document.getElementById('x-foo'); 49 convertTemplatesToShadowRootsWithin(xfoo); 50 let sr = xfoo.shadowRoot; 51 let xbar = sr.querySelector('div'); 52 convertTemplatesToShadowRootsWithin(xbar); 53 54 let elements = [ 55 'i0', 56 'x-foo/j5', 57 'x-foo/x-bar', 58 'x-foo/x-bar/k1', 59 'x-foo/x-bar/k0', 60 'x-foo/j1', 61 'x-foo/j2', 62 'x-foo/j3', 63 'x-foo/j4', 64 'i1', 65 'i2', 66 'x-foo/j0', 67 'x-foo/j6' 68 ]; 69 70 await assert_focus_navigation_bidirectional(elements); 71 }, 'Focus controller should treat slots as a focus scope.'); 72 </script>