| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| |
| <script> |
| function clickOn(el) { |
| return new Promise(function(resolve, reject) { |
| chrome.gpuBenchmarking.pointerActionSequence([{ |
| source: 'mouse', |
| actions: [ |
| { name: 'pointerDown', |
| x: el.offsetLeft + 5, |
| y: el.offsetTop + 5 |
| }, |
| { name: 'pointerUp' } |
| ] |
| }], resolve); |
| }); |
| } |
| </script> |
| <body> |
| <div id='normalDiv' tabindex='0'><span id='normalSpan'>OK</span></div> |
| <div id='container'><span id='slottedSpan'>OK</span></div> |
| </body> |
| <script> |
| let sr = container.attachShadow({ mode: 'open' }); |
| sr.innerHTML = '<div id="shadowDiv" tabindex="0"><slot></slot></div>'; |
| |
| promise_test(async () => { |
| await clickOn(normalSpan); |
| assert_equals(document.activeElement, normalDiv); |
| await clickOn(slottedSpan); |
| assert_equals(sr.activeElement, sr.getElementById('shadowDiv')); |
| }, 'Clicking on non-focusable slot inside focusable button will make the flat-tree focusable ancestor get focused'); |
| </script> |