-
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
Shortcode Block: fix layout margin override #55028
Conversation
Size Change: -123 B (-0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
[data-type="core/shortcode"] { | ||
&.components-placeholder { | ||
min-height: 0; | ||
} | ||
} |
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 style is intended to override the Placeholder's minimum height. However, since min-height
has been removed in #54216, it is no longer needed.
Flaky tests detected in dda69a8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6402001168
|
dda69a8
to
8aff2e6
Compare
8aff2e6
to
7a86e2a
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
7a86e2a
to
be42fea
Compare
be42fea
to
8180df0
Compare
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 fixing this @t-hamano! It's working well for me and it makes total sense to use the same placeholder component as all the other blocks.
One thing that I noticed while testing is that on pasting a URL into the shortcode textarea the whole block is transformed into a Paragraph. I can reproduce it on trunk (so it's not a side-effect of this PR) but I can't on WP 6.5.3. This must have been a fairly recent change? but no idea what caused it. I was testing with the wp audio shortcode, which takes a src
attribute.
@tellthemachines Thanks for the review!
Yes, this is a regression happening with the latest Gutenberg 😅 This issue has been reported on #61377. |
What?
This PR fixes an issue where the shortcode block's
margin:0
is prioritized and layout margins are not applied.Why?
This Shortcode block has a wrapper div given the
component-placeholder
class, and this component has zero margin.This margin was previously probably overridden by layout margins. However, this problem came to light because #47858 lowered the level of detail of the selector.
How?
I added a div element inside the block and gave it thecomponents-placeholder
class.Ideally, it could be refactored using aPlaceholder
component, similar to RSS blocks, Embed blocks, etc. However, the label size changes significantly, so I've only fixed the margins for now. As a follow-up to this PR, weu may be able to replace it with a Placeholder component and adjust the style.#59275 improved the
Placeholder
component and unified the label size to a smaller size. With this, I was able to completely replace it with thePlaceholder
component.Testing Instructions
Insert multiple shortcode blocks and make sure margins are applied between the blocks.