Skip to content

getOverflowAncestors should traverse through parent iframes #2518

@jsnajdr

Description

@jsnajdr

Describe the bug
Since #2043 the getBoundingClientRect DOM util function traverses all the parent iframes and adds their offsets, so that the computed offset is always relative to the top-level document.

But it turns out that one piece is missing for full seamless iframe support. The autoUpdate function has ancestorResize and ancestorScroll options. They cause that all ancestor scrolling elements get resize and scroll listeners and that position is recomputed when the reference and floating element get scrolled relative to each other.

But the getOverflowAncestors DOM util function doesn't traverse through parent iframes. It stops when it reaches the current frame's document element. If the iframe is inside a scrolling container:

<div id="floating">popover</div>
<div id="scrolling" style="overflow: auto">
  <iframe>
    <div id="reference">anchor</div>
  </iframe>
</div>

Then when the #scrolling contents scroll, then autoUpdate doesn't catch that.

To Reproduce
I don't have a minimal repro example yet. I'm interested in working on a fix, together with tests and all.

Cc @ciampo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions