position-sticky-input-box-gets-focused-after-scroll.html (807B)
1 <!DOCTYPE html> 2 <title>Focusing on visible sticky input box should scroll to unshifted sticky position.</title> 3 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" /> 4 <meta name="assert" content="This test checks that focusing on visible sticky 5 positioned input box should not scroll the page." /> 6 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <style> 11 body { 12 height: 2000px; 13 } 14 15 input { 16 position: sticky; 17 top: 10px; 18 } 19 </style> 20 21 <input type="text" id="input"/> 22 23 <script> 24 test(() => { 25 var input = document.getElementById('input'); 26 window.scrollTo(0, 100); 27 input.focus(); 28 assert_equals(window.scrollY, 0); 29 }, 'Focusing on visible sticky input box should reset the scroll to unshifted sticky position.'); 30 </script>