-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
MediaPlaceholder: Fix position of URLPopover #51363
MediaPlaceholder: Fix position of URLPopover #51363
Conversation
Size Change: +123 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
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.
The code changes LGTM, they are basically passing as the anchor
the same element that should otherwise be implicitly used as the anchor.
As you mentioned, weird that this doesn't work on trunk
. Would be curious to hear more about what's not working here, in case you ever get to debug this a little more.
Thank you!
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.
Thanks for the reviews! |
What?
Fix the position of the URLPopover used in the MediaPlaceholder component by explicitly providing a ref.
Why?
I noticed that the position of the URLPopover in the MediaPlaceholder component was incorrect. After doing a
git bisect
it appears that the issue has been present since #46212 when the post editor was updated to use an iframe. The issue was most noticeable with the list view open.I'm not 100% sure the exact cause, but my suspicion is that when using an implicit parent approach for the
Popover
component, it doesn't play nicely when it has to cross iframe boundaries sometimes. Without going too much further into it, this fix of explicitly passing down aref
to the expected container appears to work.How?
renderUrlSelectionUI
over to a separate component, add auseState
to grab a ref for the input container. Pass theref
to theURLPopover
.renderUrlSelectionUI
function as-is to try to keep this diff as small as possible, since that function call is used in several places. It seemed a bit neater to preserve that function call than replace it with<URLSelectionUI />
directly.Testing Instructions
trunk
the position of the popover will be incorrect. With this PR applied, the popover should be positioned beneath the input containerScreenshots or screencast