Tests: Wait for iframe scroll range before wheel
Let the iframe render before setting it to its bottom scroll boundary. Otherwise the scrollTop assignment can clamp against stale geometry on slow CI runs, leaving the iframe able to consume the wheel event instead of falling back to the parent viewport.
This commit is contained in:
parent
ae299920f2
commit
ad9c8df75a
1 changed files with 5 additions and 1 deletions
|
|
@ -22,6 +22,7 @@
|
|||
promiseTest(async () => {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.id = "iframe";
|
||||
const iframeLoaded = new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
|
||||
iframe.srcdoc = `
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
|
|
@ -34,7 +35,10 @@
|
|||
`;
|
||||
document.body.prepend(iframe);
|
||||
|
||||
await new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
|
||||
await iframeLoaded;
|
||||
// Let the iframe compute its scroll range before clamping scrollTop to its bottom edge.
|
||||
await animationFrame();
|
||||
await animationFrame();
|
||||
|
||||
const scrollingElement = iframe.contentDocument.scrollingElement;
|
||||
scrollingElement.scrollTop = 10000;
|
||||
|
|
|
|||
Loading…
Reference in a new issue