-
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
Fix specificity for buttons with outline style and background colors #24599
Conversation
When the .wp-block-button.is-style-outline .wp-block-button_link selector was added, its specificity (030) overrode existing theme selectors that had 020 specificity.
Size Change: +165 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
This reverts commit a730cf3.
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.
Thanks, sorry for delaying the fix. We might need to rethink it later.
…24599) When the .wp-block-button.is-style-outline .wp-block-button_link selector was added, its specificity (030) overrode existing theme selectors that had 020 specificity.
While testing this I ran into some odd behaviour,
|
Follow up to #24599. Using the child combinator (instead of the descendant combinator) narrows the selector without increasing its specificity. This should help reduce the likelihood of a style issue occurring when a parent element has an `is-style-outline` CSS class. https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator
hi @sannevndrmeulen this fix hasn't yet made available. It will be in Gutenberg 8.9 (to be released this week) and WordPress 5.5.1 (to be released soon). So, unless you've compiled and tested specifically this PR, what you experienced is the current buggy behavior. |
Hi, Please don't forget about #24625 too. Thanks! |
Follow up to #24599. Using the child combinator (instead of the descendant combinator) narrows the selector without increasing its specificity. This should help reduce the likelihood of a style issue occurring when a parent element has an `is-style-outline` CSS class. https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator
Fixes https://github.com/WordPress/gutenberg/pull/21816/files#r471447642
Related: forum thread
This fixes a regression for the button block when the outline style is applied: unlike WordPress 5.4, the background color wasn't applied in this scenario.
Test
The expected result is that the button has the background color selected, both in the editor and in the front. Tested with the themes TwentyTwenty, TwentyNineteen, TwentySeventeen. This was the behavior in 5.4 that we regressed in 5.5.