focus-scroller-layout-update.html (878B)
1 <!DOCTYPE html> 2 <script src='/resources/testharness.js'></script> 3 <script src='/resources/testharnessreport.js'></script> 4 <script src='../resources/focus-utils.js'></script> 5 6 <button id="button">Button</button> 7 <div id="scroller" style="overflow:scroll; width:50px; height:50px;"> 8 <div style="height:100px"></div> 9 </div> 10 11 <script> 12 promise_test(async () => { 13 const button = document.getElementById('button'); 14 const scroller = document.getElementById('scroller'); 15 16 scroller.focus(); 17 assert_equals(document.activeElement, scroller); 18 19 button.focus(); 20 assert_equals(document.activeElement, button); 21 22 scroller.style.height = '200px'; 23 scroller.focus(); 24 assert_equals(document.activeElement, button, 'Should not focus on scroller since it is no longer scrollable'); 25 }, 'When checking that element is a scroller, layout information should be up to date.'); 26 </script>