Add better cross-document support#1884
Closed
ciampo wants to merge 7 commits intofloating-ui:masterfrom
ciampo:feat/cross-document
Closed
Add better cross-document support#1884ciampo wants to merge 7 commits intofloating-ui:masterfrom ciampo:feat/cross-document
ciampo wants to merge 7 commits intofloating-ui:masterfrom
ciampo:feat/cross-document
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.
|
ciampo
commented
Sep 13, 2022
Comment on lines
+63
to
+68
| 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')); | ||
| }, []); |
Author
There was a problem hiding this comment.
This fix doesn't really seem to work for now. I'll need to find a better way to force floating-ui to update
This was referenced Sep 20, 2022
Collaborator
|
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
animationFrameautoupdate strategyHow
In particular, this PR:
VirtualElementtype —ownerDocument. This prop is necessary to implement checks for cross-document support.getRectRelativeToOffsetParentfunction in thedompackage, taking into account (when needed) the offset of the reference's parentiframe