Skip to content
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

Outlined button block does not apply custom text color #24625

Closed
webmandesign opened this issue Aug 18, 2020 · 6 comments · Fixed by #26707
Closed

Outlined button block does not apply custom text color #24625

webmandesign opened this issue Aug 18, 2020 · 6 comments · Fixed by #26707
Assignees
Labels
[Block] Buttons Affects the Buttons Block CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@webmandesign
Copy link
Contributor

Describe the bug
If I apply a text color on an outlined button, the color is not applied as default text color from the block itself is overriding it.

(The issue is described at WordPress support ticket.)

To reproduce
Steps to reproduce the behavior:

  1. Add a button to post content.
  2. Set the button style to outlined.
  3. Set the custom (theme predefined) text color for the button.

Button now has the #32373c ($dark-gray-700) color instead of the custom theme-predefined color.

Expected behavior
Once a theme-predefined color class is set on button link, it should not apply any other text color.

Editor version (please complete the following information):

  • WordPress version: 5.5
  • Default editor, no Gutenberg plugin installed.
@webmandesign
Copy link
Contributor Author

Also, is there any reason to force a specific text color on outlined button? I went ahead and adapted the pull request to inherit the text color of the container.

@aristath aristath added [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. CSS Styling Related to editor and front end styles, CSS-specific issues. labels Aug 19, 2020
@mtias mtias added the [Block] Buttons Affects the Buttons Block label Aug 29, 2020
@webmandesign
Copy link
Contributor Author

Hi guys,

Is there any update on this please? Are theme developers stuck by forcing custom theme color styles with very high specificity selectors or !important?

I can see this is not an isolated issue with block colors since WP5.5 update: check the issue #25290 for example.

Thanks for any feedback provided.

Regards,

Oliver

@tellthemachines tellthemachines added the [Type] Bug An existing feature does not function as intended label Oct 21, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 4, 2020
@tellthemachines
Copy link
Contributor

I can no longer reproduce this issue in WP 5.5.3; it may have been fixed in the meantime. Can you confirm this, @webmandesign ?

@webmandesign
Copy link
Contributor Author

Please note that it depends highly on a theme you are using. If the theme has sufficient enough selector specificity for its color classes, then you don't experience the issue. However, it's still present as the code in current Gutenberg v9.3.0 hasn't changed and it still forces a specific color (at least it should be set to inherit and not to a specific color).

Example:

If your theme followed Gutenberg handbook to apply Gutenberg support for color palettes, it is using pure, straightforward .has-strong-magenta-color { ... } selectors for the color classes (taken from example in Gutenberg handbook). So, selector is just a single class name.

In this case Gutenberg's Button block code takes over and overrides the simple class selector of the theme and thus not applying a custom color as expected.

Solution for theme author is to use higher specificity selector for the theme color classes such as html body .has-strong-magenta-color { ... }. My point is I don't think this should be necessary.

Besides, there is really no reason why Gutenberg applies specific color (color: #32373c;) on the outlined button. This should really be color: inherit; so it falls back to text color of the container.

My patch #24626 fixes both of these issues. Please check.

@tellthemachines
Copy link
Contributor

Thanks for working on this @webmandesign ! Looks like we'll be going with #26707 instead, as it fixes the issue for both color and background-color on outlined buttons.

@webmandesign
Copy link
Contributor Author

Hi @tellthemachines Thanks for the info. Please read my feedback on #26707 for more information.

jorgefilipecosta pushed a commit to webmandesign/gutenberg that referenced this issue Nov 6, 2020
To reduce potential of style conflicts. (+2 squashed commits)
Squashed commits:
[4a3717f8da] Inherit a text color for outlined button, not forcing a specific one
[8b062a80bd] Do not apply text color if it is being overriden

Fixing WordPress#24625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants