delegatesFocus-tabindex-change.html (832B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 6 <body> 7 <script> 8 test(() => { 9 const host = document.createElement('div'); 10 document.body.appendChild(host); 11 12 const shadowRoot = host.attachShadow({mode: 'open', delegatesFocus: true}); 13 14 const shadowInput = document.createElement('input'); 15 shadowRoot.appendChild(shadowInput); 16 17 host.focus(); 18 assert_equals(document.activeElement, host, 'The shadow host should be focused.'); 19 20 host.setAttribute('tabindex', '0'); 21 assert_equals(document.activeElement, host, 'The shadow host should remain focused after changing tabindex.'); 22 }, 'Setting tabindex on the shadow host of a focused element with delegatesFocus should not change focus.'); 23 </script>