-
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
Fix specificity issue between theme and user styles #29533
Conversation
Size Change: +194 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
31d613b
to
e5a92b6
Compare
Given how the style system works, !important is a good choice for preset classes the user attaches to the post content. If those values need to be overridden, in addition to regular CSS, we can offer hooks for the theme.json processing, so plugins have an alternate mechanism to modify this behavior.
e5a92b6
to
980a0b6
Compare
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.
Makes sense to me, but other opinions would be good too.
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.
LGTM 👍
I'm sure lots of people will say that !important
is evil, but sometimes it's the best tool for the job.
OK, I think I'm going to land this so we can get better feedback ― this is something that's easily reversible so we can course-correct later, if necessary. |
Wanted to share #29985 (comment) for all that follow this PR. |
Hi guys, I'm very late to the party, but the issue with From your conversation above:
There may be potentially a big issue with Gutenberg not applying "BEMish" naming on modifier CSS classes. Although it uses BEM for block classes (such as It is especially impossible to target If Gutenberg used BEMish naming for modifier classes such as Also, there is no way for theme authors to know about potential redundancy of It seems like there is no documentation for Gutenberg best practices and standards so even extension plugins can follow these to make the ecosystem more consistent. (→ could be of an interest for @annezazu re dev focused communication site) It's also confusing that colors have a helper class ( But like I've mentioned, this issue could be resolved with more modular naming of CSS classes. Do you think it is worth to log a new issue ticket for this problem? |
Hey Oliver. Sure, if there's an issue with how current classes work that merits an independent conversation. |
Hi André, There is actually no issue currently with the classes. I will open a new issue for discussion. Thanks. |
Hi Oliver, if there's no current issue but you still want to share your thoughts on something, I believe https://github.com/WordPress/gutenberg/discussions would be a better place as it helps keep Gutenberg issues for triaging actual product bugs/features/etc. |
Thanks for pointing me in the right direction. |
Fixes #29381
How to test
The expected behavior would be that the user choices are respected, both in the editor and front-end.