Reduce element selectors for editor css to avoid specificity issues for block authors #9881
Labels
[Feature] Custom Editor Styles
Functionality for adding custom editor styles
[Type] Enhancement
A suggestion for improvement.
Describe the
bugenhancementUpdate: Upon seeing the update for 3.8, I noticed some of this is gone. Which is nice! :D But there is still a property coming through:
Before update:
Ideally, there would be no generic element selectors in the editor styles. This would allow opt-in to Gutenberg styles. These selectors below...
...requires our custom block's css to fight for higher specificity to get our own colors, fonts, etc working as expected. My team and I are willing to help work on a PR for this.
To Reproduce
Steps to reproduce the behavior:
<p>
tag..edit-post-visual-editor, .edit-post-visual-editor p {...
Expected behavior
We expected that custom blocks, that implement p tags, would not have to override the styles declared by the editor's css selectors. It was expected that a class could be optionally added to p tags (or any markup) in custom blocks, components, or controls to achieve a 'default' Gutenberg style.
I've added this example below to illustrate a possible solution (it does not account for possible class name collisions at the moment, and could certainly be much better named. I've replaced the
p
selector with other ideas for selectors:I'm looking into the CSS naming conventions for Gutenberg now, to further my example if that can be applied here. There is no directory, for the second piece of the selector though, so I've substituted words like generic, general, element, for now.
Additional context
N/A
Thanks for reading :)
The text was updated successfully, but these errors were encountered: