-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Try: Cover positioning fix take 1. #28650
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
Closed
Closed
Conversation
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
Contributor
Author
|
Incidentally, the above mans the collapsing embed has almost certainly been "broken" since #21091 was merged. |
|
Size Change: -5 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Block] Cover
Affects the Cover Block - used to display content laid over a background image
[Type] Bug
An existing feature does not function as intended
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.
This hopes to fix #28640.
When you use an embed block inside a cover block, and use the matrix alignment tool, the embed disappears.
This is due to these two lines of code: https://github.com/WordPress/gutenberg/pull/21091/files#diff-9e449d4b8bd69c9771de8e20c9a1d78798a6934f99e3bfc432df6ceb23def7f4R156
What happens is that when the matrix alignment tool is used, all content inside is "collapsed" to the smallest size of the content. Which in the case of an embed block is 0x0.
As soon as you add something else, just a single paragraph of text, the embed will be as wide as that embed:
This PR changes that CSS so it doesn't collapse. But this is probably not the solution.
So why was that CSS introduced in the first place? Because without it, the matrix alignment doesn't appear to work. Observe the master branch:
That paragraph is centered, and full width, yet it is able to align to all corners. Because its margin was zeroed out, and its width set to auto. The text alignment of the paragraph isn't actually changed, it's still centered — it's just centered inside a container as wide as its text.
Here's how that breaks with this branch:
Observe how the text remains centered, because it is centered inside a full width paragraph, and it doesn't reach its corners because the margin remains.
So while this PR technically fixes the issue — the embed doesn't collapse — it breaks the spirit of the matrix alignment in the process.
I'm going to open a separate PR with an alternate take, but figured this PR would be a good test case and explainer for the issue.