<!DOCTYPE html>
<style>
iframe {
position: absolute;
top: 50px;
width: 100px;
height: 100px;
border: 1px solid black;
}
::-webkit-scrollbar {
width: 0px;
}
</style>
<div style='width:10px;height:2000px;background:white;position:absolute'></div>
<iframe src='http://127.0.0.1:8000/navigation/resources/focus-shifting-frame-with-anchor.html' sandbox='allow-scripts'></iframe>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
}
onload = function() {
if (window.eventSender) {
// Give the frame user gesture to make sure 'focus' API works.
const iframe = document.querySelector("iframe");
iframe.contentWindow.postMessage("click-body", "*");
}
};
onmessage = function(e) {
if (e.data === "reply") {
// By placing the rAF call inside the message handler, we are guaranteed
// that the subframe has completed its rAF call before we get to this point.
requestAnimationFrame(function() {
if (window.testRunner) {
testRunner.notifyDone();
}
});
}
};
</script>