-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better cross-document support #1884
Conversation
@floating-ui/core (1.0.1 → 1.1.0)New Features
@floating-ui/dom (1.0.1 → 1.1.0)New Features
Packages With No ChangesThe following packages have no user facing changes, so won't be released:
|
✅ Deploy Preview for vibrant-gates-22c214 canceled.
|
useLayoutEffect(() => { | ||
// Hack to force a re-render that also creates new values for | ||
// `refs` and/or `update`, so that `useScroll` updates internally | ||
// and scrolls the reference element into view. | ||
setTimeout(() => setPlacement('bottom-start')); | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix doesn't really seem to work for now. I'll need to find a better way to force floating-ui
to update
I've made a PR here that seems to solve it — I haven't bothered with nested iframes but does that have any actual use case? |
Closes #1869
What
This PR adds better support for cases where the reference and the floating elements are in two different documents — for example, if the reference is inside an
iframe
, while the floating element is rendered in the top-level document.TODO:
animationFrame
autoupdate strategyHow
In particular, this PR:
VirtualElement
type —ownerDocument
. This prop is necessary to implement checks for cross-document support.getRectRelativeToOffsetParent
function in thedom
package, taking into account (when needed) the offset of the reference's parentiframe