focus-navigation-slot-with-tabindex.html (1959B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-vendor.js"></script> 6 <script src="/resources/testdriver-actions.js"></script> 7 <script src="resources/shadow-dom.js"></script> 8 <script src="resources/focus-utils.js"></script> 9 <div id='log'></div> 10 <p> 11 document tree: [i0 -> [x-foo]]<br> 12 x-foo's shadow tree: [j1 -> [s1] -> [s2] -> j2 ->[x-bar]]<br> 13 x-bar's shadow tree: [[s3] -> k1]<br> 14 slot #s1: [i1 -> i2]<br> 15 slot #s2: [i3]<br> 16 slot #s3: [l1 -> l2]<br><br> 17 <b>v1 ideal nav forward: [i0 -> j1 -> i1 -> i2 -> i3 -> j2 -> x-bar -> l1 -> l2 -> k1]</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 <input id='i3' slot='s2' tabindex=3 value='i3'> 25 <template data-mode='open'> 26 <div id='x-bar' tabindex=5> 27 <input id='l2' slot='s3' tabindex=2 value='l2'> 28 <input id='l1' slot='s3' tabindex=1 value='l1'> 29 <template data-mode='open'> 30 <slot id='s3' name='s3' tabindex=1></slot> 31 <input id='k1' tabindex=2 value='k1'> 32 </template> 33 </div> 34 <input id='j1' tabindex=1 value='j1'> 35 <slot id='s2' name='s2' tabindex=3></slot> 36 <slot id='s1' name='s1' tabindex=2></slot> 37 <input id='j2' tabindex=4 value='j2'> 38 </template> 39 </div> 40 41 <script> 42 'use strict'; 43 44 promise_test(async () => { 45 let xfoo = document.getElementById('x-foo'); 46 convertTemplatesToShadowRootsWithin(xfoo); 47 48 let elements = [ 49 'i0', 50 'x-foo/j1', 51 'i1', 52 'i2', 53 'i3', 54 'x-foo/j2', 55 'x-foo/x-bar', 56 'x-foo/l1', 57 'x-foo/l2', 58 'x-foo/x-bar/k1', 59 ]; 60 61 await assert_focus_navigation_bidirectional(elements); 62 }, 'Slots tabindex should be considred in focus navigation.'); 63 </script>