-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Tag Cloud: Prevent duplicate spacing in editor #63832
Tag Cloud: Prevent duplicate spacing in editor #63832
Conversation
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. |
Size Change: +161 B (+0.01%) Total Size: 1.76 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.
Thanks for the thorough review @ramonjd
For block supports themselves, the Tag Cloud block should already omit those block support attributes and classes. Anything can be styled via theme.json and global styles, so I agree this isn't a complete solution. In my view, the only complete solution is to refactor the block to use the REST API instead of server-side rendering. If we go the route of resetting all styles, we'd need to do that for anything that could be styled via theme.json. That includes any custom CSS the theme or user adds. I'm not sure that is feasible in the short term either. For now, this PR addresses the most glaring issue, buying time to see the impact of what remains and/or refactor the block. |
Fixes: #63716
What?
Avoids the duplicate application of default padding and margin styles on the Tag Cloud block in the editor due to its use of server-side rendering.
Why?
Without these changes, default margin and padding are applied twice creating a visual difference between the editor and frontend.
How?
.wp-block-tag-cloud
classAlternate Approach
Initially, it was suggested to reset the spacing styles on the outer wrapping element in the editor. The catch here is that there is default padding for different alignments and the CSS classes for those alignments are only applied to the outer wrapper.
If the spacing style resets occur on the outer wrapper, these defaults need to be plumbed through to the inner
p.wp-block-tag-cloud
element. The current approach in this PR minimises any additional CSS to reset spacing.Testing Instructions
p.wp-block-tag-cloud
element and ensure that padding and margin styles are resetScreenshots or screencast