MediaPlaceholder: Fix position of URLPopover#51363
Merged
andrewserong merged 1 commit intotrunkfrom Jun 12, 2023
Merged
Conversation
|
Size Change: +123 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
ciampo
approved these changes
Jun 11, 2023
Contributor
ciampo
left a comment
There was a problem hiding this comment.
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!
Contributor
Author
|
Thanks for the reviews! |
sethrubenstein
pushed a commit
to pewresearch/gutenberg
that referenced
this pull request
Jul 13, 2023
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.

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 bisectit 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
Popovercomponent, 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 arefto the expected container appears to work.How?
renderUrlSelectionUIover to a separate component, add auseStateto grab a ref for the input container. Pass therefto theURLPopover.renderUrlSelectionUIfunction 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
trunkthe position of the popover will be incorrect. With this PR applied, the popover should be positioned beneath the input containerScreenshots or screencast