serenity/Tests/LibWeb/Ref/scroll-iframe.html
Aliaksandr Kalenik bf14de4118 LibWeb: Remove direct calls of page_did_request_scroll_to()
By replacing the `page_did_request_scroll_to()` calls with a request
to perform scrolling in the corresponding navigable, we ensure that
the scrolling of iframes will scroll within them instead of triggering
scroll of top level document.
2024-02-03 19:00:26 +01:00

24 lines
720 B
HTML

<!DOCTYPE html>
<link rel="match" href="reference/scroll-iframe-ref.html" />
<style>
iframe {
width: 200px;
height: 200px;
border: 1px solid black;
}
</style>
<body></body>
<script>
const iframe = document.createElement("iframe");
iframe.srcdoc = `
<style>body { margin: 0 }</style>
<div style="width: 200px; height: 200px; background-color: darkblue"></div>
<div style="width: 200px; height: 200px; background-color: blue"></div>
<div style="width: 200px; height: 200px; background-color: magenta"></div>
`;
iframe.onload = function () {
iframe.contentWindow.scroll(0, 200);
};
document.body.appendChild(iframe);
</script>