It seems Chrome and Firefox have two different interpretations of scrollIntoView() when it comes to iframes. In Chrome, the scrolling only applies to elements until a position:fixed ancestor element is found, whether it is in the iframe or parent frame. But in Firefox, it is not just any ancestor that has position:fixed; there seems to need to be an unscrollable ancestor element in the parent frame also, otherwise the parent frame will still scroll.
I want to prevent Firefox from scrolling the parent frame in this case. So far the only solution I have found is making an element in the parent frame be position:fixed, but as you can imagine that will ruin the parent frame's layout if you don't want a fixed element and want the page to flow (eg, if the iframe is embedded within a long blog post).
Note that I do NOT have control over the iframe (it is cross domain also), otherwise I could just switch scrollIntoView() with scrollTo().
Here is a concrete example you can test:
<html>
<head>
<title>Parent frame</title>
<style>
html { scroll-behavior:smooth; }
</style>
</head>
<body>
<iframe src="iframe.html" style="height:200px;"></iframe>
<div style="height:10000px;">parent</div>
</body>
</html>
<html>
<head>
<title>Child frame</title>
<style>
</style>
<script>
setTimeout(function() {
var bottom = document.getElementById("bottom");
bottom.scrollIntoView();
}, 2000);
</script>
</head>
<body>
<div id="someParent" style="height:200px;position:fixed;overflow:scroll;">
<div style="height:5000px;">iframe</div>
<div id="bottom" style="background-color:red;">bottom</div>
</div>
</body>
</html>