Global styles are overridden by theme's CSS #61533
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Bug
An existing feature does not function as intended
Description
I ran into an issue at a client's site after updating Gutenberg Plugin to 18.2 release at development environment. This site runs a custom Blockbase child theme with Bootstrap, WordPress, plugins and themes are all updated to their latest versions.
The issue is that some Global Styles set at the theme.json file are overridden by Bootstrap's CSS, even though it's loaded before Global Styles.
I expected theme's Global Styles would override any other libraries I use to develop my theme.
Step-by-step reproduction instructions
I investigated what's happening and I understand it's because some Global Styles selectors have been replaced with less specific ones at this PR #60106
Screenshots, screen recording, code snippet
Like for example, Global Styles rules that would be applied to
body
element :now are applied to
:where(body)
I can fix this by customizing Bootstrap and compiling my own Bootstrap CSS, I haven't done that because this is double work.
So I guess this will be an issue for other themes and plugins that use third party libraries or that have their own CSS, many times required to work.
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: