When I create a global class named .button and assign it to a button the font size is set to 13 px. This seems to be some internal styling from Cwicly (see screenshot). It does not affect the frontend.
Also if I set a specific font size it works. Only if there is no Font size chosen the 13 px will be used.
Step-by-step reproduction instructions:
Please write the steps needed to reproduce the bug.
- Create a global class named “button”
- apply some styling to it but do not chose a font size
- apply the class to a button
- the button will get the font size of 13 px
Screenshots, screen recording, code snippet
- WordPress version: latest
- Gutenberg Plugin version: -
- Cwicly Plugin version: latest
- Cwicly Theme version: latest
To see the effect you only have to give a button block the virtual class “button”.
This is what you will get (I did not apply any styling):
As the class names and the visual button appearance do suggest, these are WordPress styles, which are required for the backend UI, which also includes the builder environment.
Not sure if Cwicly can do something here. Interesting find though, and indeed kind of unfortunate.
Oh, you are right. Did not look closely enough. Was just happy that I found the source^^
But sure, it definitely is a minor inconvenience.
@Jonas, I would suggest to not use
.button as a class name. It’s too generic, but it’s also used by so many plugins (and WP as you are finding out). Depending on your build, you might have multiple plugins that have style definitions for their
.button, so conflicts are inevitable.
Better to be more descriptive like
btn-primary or something similar.
Yes. Using a unique global class is recommended to avoid class/code conflict.
That’s true. That’s exactly what I did now, thanks!
But other than the backend I did not notice any more conflicts. Usually plugins don’t use terms like “button” exactly for this reason – actually I never noticed any plugin that does this (at least not in the frontend).
You’d be surprised how many do just that. Some developers are lazy, lol. There’s one plugin I use that’s actually super useful and better than most of the others on the market. But these guys wouldn’t even give their divs class names or even IDs.
In order to style the front end, I’m having to make up selectors like
div:only-child>div:nth-of-type(3) or some other weird combination.
That is something I can relate to Often times elements do not have a class and we have to think of selectors like your example. But if they use classes they usually have the plugin initials in front of “button” for example.
Moving this thread to General as it isn’t a bug per se.
Thanks @Marius, @owynter and @jornes for helping @Jonas out!