Open
Description
Because of this line:
compute-scroll-into-view/src/index.ts
Line 259 in 9b4e9e6
Here it accesses document
as a global, but when you execute this function from the iframe's parent's context, the document outside of the iframe is selected which results in the wrong behavior.
I think instead of getting document
as a global here, we can also get it from the element directly.
So that would become something like:
const targetDocument = target.ownerDocument!
const scrollingElement = targetDocument.scrollingElement || targetDocument.documentElement