-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove excess <p> from Tag Cloud edit function #63716
Comments
The block uses server-side rendering; the tag cloud markup is the same on both ends as a single |
Right, but a block wrapper exists on the edit function, which moves the p inside, which causes it to get margin applied. |
Came here to report this issue. Glad to find out it already been noticed. |
I can take a look into this one this week but I'm not sure there is a true fix unless we rewrite the Tag Cloud edit JS component to use the REST API for everything. A while ago, there was an effort to reduce some of the double-up of padding/margin etc when block supports were applied to server-side rendered blocks. The following PRs show a bit of that history.
The way the server-side rendering works, I don't think the wrapper can be removed. There might be two compromise options to move forward in the short term:
Any thoughts? Is there enough value in refactoring this block to use the REST API to warrant the dev time? There may need to be some updates to the REST API too if any functionality is missing. |
Maybe the simplest solution is to add block css to negate the margin within the editor. |
Second this! |
@aaronrobertshaw we might have to do same for other block support attribute styles like background, colors, border etc. |
Thanks @akasunil, this issue is a little more slanted towards the spacing issues caused by default and global styles. Block supports should already be taken care of by the If there is a problem with the skipping of block support attributes and classes that would be best as a separate issue as it would affect all blocks using server-side rendering. To be able to effectively debug further we need some steps to replicate the issue and a screenshot that shows the conflicting styles. |
@aaronrobertshaw I used the Tag Cloud Block to test color support, and I found that block and styles were not working properly. Here is video for reference. Blog-Home-.-Template-.-gutenberg-.-Editor-.-WordPress.8.webmIt appears that block style takes precedence over global styles applied to the block, it should be the other way around.
|
@akasunil this discussion might be better over on your PR proposing to add color support to the Tag Cloud block.
It appears as though this video is highlighting the spacing issue #63832 addresses in a superficial manner. I've only just merged that PR a minute ago so it should be resolved now.
I think this is back-to-front. Block instance styles should take precedence over global styles. The issue is that the color block support classes and inline styles aren't being inherited by the server-side rendered block markup. The best approach there might be to follow what was done for the Latest Comments block. Rather than skip all block support attributes, the block manually filters problematic support styles (e.g. spacing) out. |
In the edit function of the Tag Cloud block, there is a secondary
<p>
within the block, around the tags. This does not occur on the front-end. The extra<p>
within the block is causing additional default browser margin to be applied within the block only within the editor. The front-end looks as expected.I propose the edit function is updated to accurately reflect the front end, which will bring these closer to 1:1.
Editor
Frontend
The text was updated successfully, but these errors were encountered: