-
Notifications
You must be signed in to change notification settings - Fork 360
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
Blockbase: Ponyfill css overrides block-level global styles for Button block #4435
Comments
The button portion of the related ponyfill is here. That relates to the video shown but it's not the only place where this is happening. This is happening because many of Blockbase's selectors have a higher specificity than the styles generated by Global Styles. This is especially obvious with the button which has a rich ponyfill system including hover states (which are going to be particularly problematic to address in this situation). |
I believe this affects the editor and the view slightly differently. In the case of the button (ignoring the hover states issue), we could theoretically solve the issue by remove the wrapping selector However, in the view, the theme CSS is loaded after the global styles CSS, so the theme CSS is still winning. This is a mismatch between editor and view, and also not the preferred order. We opened an issue above to see if we can fix this upstream. Front-end source: |
I had a quick look at this in Gutenberg and then in Blockbase. I couldn't change the order of
I did manage to force the order via Blockbase, by again changing the priority of the styles in functions.php:
Which did this: But I guess this isn't ideal as every theme would need to cater for this. Thought I'd report back in case this helps in any way, or makes it quicker for someone to work some Gutenberg magic. |
Thanks for investigating @mikachan ! It looks like WP 5.8 is registering the 'global-styles' stylesheet as well, which is taking precedence over Gutenberg's enqueue calls. But Gutenberg should be able to unregister and reregister the asset to work around this. I'll spin up a Gutenberg PR. |
Potential fix for this at WordPress/gutenberg#34147. As pointed out earlier, Blockbase styles will still need to be updated to have a css selector specificity equal or below Global Styles css. |
It looks like issues with global styles and the cover block can be attributed to specificity problems in core Gutenberg, and not from themes. WordPress/gutenberg#34150. I'll be taking a closer look tomorrow. |
Issues with global styles and the site title block are caused by CSS specificity conflicts with
themes/seedlet-blocks/assets/theme.css Lines 148 to 157 in 00ee734
I drafted a separate issue and a separate PR to address this. |
Thanks @creativecoder. That (slightly separate) issue is being dealt with in either this PR or maybe this one. |
I think that everything Button-related that CAN be solved has been via #4439 (with the known exceptions of hover state and outline variation). Blockbase alignment issues are being looked at this week in #4456 Going to close this one as complete. Please reopen if anything not tracked elsewhere continues to be an issue. |
Description
I'm seeing an issue with block-level global styling being overridden in the dotcom site editor and frontend (atomic + simple sites), and it looks like it has to do with the ponyfill.css file in
blockbase
. When I removeponyfill.css
, per block global styles work as expected.List of affected blocks
Cover (text color and background color)Not caused by blockbaseSite Title (text color and background color)Not caused by blockbaseSteps to replicate
blockbase
Button Block
Result
User customized global styles (like background color) weren't applied to the block
Expected
The block styles would change according to user customizations
Notes
The text was updated successfully, but these errors were encountered: