-
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
Tag Cloud Block: Fix outline style not applied in editor #49248
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: +68 B (0%) Total Size: 1.69 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 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. |
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,
skipBlockSupportAttributes
was added to theServerSideRender
component 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