overscroll-behavior-keyboard-scroll-child-frame.html (1924B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>overscroll-behavior for keyboard scroll in child frame</title> 4 <meta name="timeout" content="long"> 5 <link rel="help" href="https://drafts.csswg.org/css-overscroll-behavior"> 6 <link rel="author" title="Peng Zhou" href="mailto:zhoupeng.1996@bytedance.com"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="/dom/events/scrolling/scroll_support.js"></script> 13 <script src="/css/css-scroll-snap/support/common.js"></script> 14 <style> 15 body { 16 margin: 0; 17 } 18 19 #container { 20 overflow: auto; 21 height: 600px; 22 position: relative; 23 } 24 25 iframe { 26 width: 600px; 27 height: 400px; 28 position: absolute; 29 top: 500px; 30 } 31 </style> 32 <div id="container"> 33 <iframe id="iframe" src="resources/keyboard-scroll-child-frame-iframe.html"></iframe> 34 </div> 35 <script> 36 window.addEventListener('load', () => { 37 promise_test(async () => { 38 const target = iframe.contentWindow; 39 let scrollEndPromise = waitForScrollEndFallbackToDelayWithoutScrollEvent(container); 40 container.scrollTop = 300; 41 await scrollEndPromise; 42 43 scrollEndPromise = waitForScrollEndFallbackToDelayWithoutScrollEvent(target); 44 target.scrollTo(0, 50); 45 await scrollEndPromise; 46 assert_equals(target.scrollY, 50); 47 48 await new test_driver.Actions() 49 .pointerMove(200, 300) 50 .pointerDown() 51 .pointerUp() 52 .send(); 53 assert_equals(document.activeElement, iframe); 54 55 scrollEndPromise = waitForScrollEndOrTimeout(target, 1000); 56 await scrollElementByKeyboard('ArrowUp'); 57 await scrollEndPromise; 58 assert_equals(container.scrollTop, 300); 59 assert_equals(target.scrollY, 0); 60 }, 'scrolling is not propagated from iframe to the main frame'); 61 }); 62 </script>