Skip to content

Scroll into view in iframe not working from iframe parent context #854

Description

@bryanph

Because of this line:

const scrollingElement = document.scrollingElement || document.documentElement

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions