sticky-after-input.html (1548B)
1 <!doctype html> 2 <title>Sticky positioned element should reset the scroll position to unshifted position</title> 3 <link rel="author" title="Seokho Song" href="mailto:0xdevssh@gmail.com"> 4 <link rel="help" href="https://crbug.com/664246"> 5 <link rel="help" href="https://crbug.com/1178622"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 12 <div id="scrollEl" style="height:100px; overflow-y: auto; scroll-padding:20px 20px 20px 20px;"> 13 <input id="stickyEl" type="text" style="position:sticky;top:0" /> 14 <div>1</div> 15 <div>2</div> 16 <div>3</div> 17 <div>4</div> 18 <div>5</div> 19 <div>6</div> 20 <div>7</div> 21 <div>8</div> 22 <div>9</div> 23 <div>10</div> 24 <div>11</div> 25 <div>12</div> 26 <div>13</div> 27 <div>14</div> 28 <div>15</div> 29 <div>16</div> 30 <div>17</div> 31 </div> 32 </div> 33 <script> 34 35 async_test(t => { 36 var scrollEl = document.getElementById("scrollEl"); 37 var stickyEl = document.getElementById("stickyEl"); 38 stickyEl.focus() 39 scrollEl.scrollTo(0, scrollEl.scrollHeight); 40 scrollEl.addEventListener('input', ()=> { 41 requestAnimationFrame(t.step_func(()=>{ 42 assert_equals(scrollEl.scrollTop, 0, 43 "should reset the scroll to unshifted sticky position"); 44 t.done() 45 })) 46 }) 47 test_driver.send_keys(stickyEl, "A") 48 }) 49 </script>