-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Default style class being saved to block markup. #20706
Comments
Hi @dougwollison, thank you for reporting this issue. I was able to replicate this issue in WordPress 5.3.2 without the Gutenberg plugin. |
This issue is a bit deeper than it looks. This is something that was tried before - #22266 But it had to be reverted (#23548), the change caused a bug for plugins that might register a new default (#23211). I think the idea of how default styles work needs a bit of a rethink. It doesn't really make sense for themes or plugins to provide additional defaults over the default that is already provided by core. What does it mean to have many defaults? An example of this is the button block, which has a default 'fill' style, but there are no My feeling is that the best option might be deprecating |
Great points, @talldan. Given this, I also feel that is-default should be deprecated. We can't get around the fact that plugins and themes will sometimes want to add their own default styles to blocks. All the while, I think having a default option in the BlockStyles panel could work(as a way to remove all As far as implementation goes, it could be something like:
Thoughts? |
Describe the bug
If a block supports styles and one registered as default is clicked, the class "is-style-default" (or whatever the name of the style is) is applied to the element. This is contrary to the documentation on registering block styles:
To reproduce
Steps to reproduce the behavior:
is-style-default
will be added.Expected behavior
The style class should be removed entirely if the registered style is designated as the default.
I'm currently working around this by adding a saveProps filter that removes the class, but it currently only removes the literal
is-style-default
class.Screenshots
https://imgur.com/NHBtS8M
The text was updated successfully, but these errors were encountered: