Tag Cloud Block: Fix outline style not applied in editor#49248
Conversation
|
Size Change: +116 B (+0.01%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Thanks, for the continued efforts on these server-side rendered blocks @t-hamano 👍
Can you refresh my memory on why we are stripping the block's className attribute when skipBlockSupportAttributes is passed to ServerSideRender?
CSS classes produced by block supports aren't included in that attribute. Stripping it means we lose the Block Styles class as in this use case, along with any other custom CSS class the use has applied to the block.
Removing className from the attributes stripped allows the Block Style to work as normal. At least it did for me in a quick test here.
Before we add extra CSS as proposed here, I'd like to make sure we weren't too aggressive in the removal of attributes that were supposed to be stripping only block support styles and classes.
What do you think?
|
Thank you for the review, @aaronrobertshaw! I have looked back in the past and seen comments here about how additional CSS classes should be handled.
However, from the PR that was subsequently submitted, it appears that I was proceeding under the assumption that duplication of additional CSS classes is naturally a problem as well as style and CSS classes produced by block support:
Should we rethink whether duplicating additional CSS is a problem? |
|
This looks like an issue in the way we render server side blocks in the editor. I'd be very hesitant to add this CSS because it's just masking the problem and we'll end up having to do this for all server side blocks. |
|
@scruffian The ideal solution would be to render this block in JavaScript, but I think it might be difficult to implement the As stated in this comment, if the additional CSS is not removed with |
|
I wonder if the solution is to remove the wrapper when this is rendered, so that the markup of the block in the editor is closer to the frontend. |
34b7904 to
4c44aae
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. |
|
Is the new useServerSideRender something we can use to solve the markup discrepancy between server and frontend? Otherwise we should just land this PR. |
|
The issue has been resolved with the merge of #74228. |
Fixes: #49226
Related to: #44439
What?
This PR fixes a problem where styles aren't applied correctly when the outline style is applied to the tag cloud block in the editor.
Why?
In #44439,
skipBlockSupportAttributeswas added to theServerSideRendercomponent to prevent duplication of block support styles and additional CSS classes. As a result, flex layout is now applied only to block wrapper elements, and styles are not applied to server-side renderedp.wp-block-tag-cloud.Testing Instructions
Before
After