-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Setting a link color on a parent block overrides icon and button colors #33437
Copy link
Copy link
Closed
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Setting a link color on a parent block overrides icon and button colors, but only on the frontend of the site.
Initially reported in WordPress/pattern-directory#235, can be seen (for now) on these patterns:
- https://wordpress.org/patterns/pattern/contact-and-social-links/
- https://wordpress.org/patterns/pattern/introduction-with-image-on-the-left/
Step-by-step reproduction instructions
- Add a group block, with some content including a link and a button
- Set a link color on the group
- Set a different text color on the button
- The custom button color works in the editor ✅
- Save, view on the frontend
- The button text color is now using the link color ❌
Also happens with social icons.
Expected behaviour
The editor behavior seems correct - the button text should use the set text color.
Actual behaviour
The injected style in .wp-elements-<uuid> overrides the button's inline style, because it's set to !important.
Screenshots or screen recording (optional)
| Editor | Frontend |
|---|---|
![]() |
![]() |
Code snippet (optional)
Block code
<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}}}} -->
<div class="wp-block-group has-link-color"><!-- wp:paragraph -->
<p>Start the group. <a href="https://wordpress.org" data-type="URL" data-id="https://wordpress.org">Link</a></p>
<!-- /wp:paragraph -->
<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"yellow","textColor":"black"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-black-color has-yellow-background-color has-text-color has-background" href="https://wordpress.org">Link Button</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
<!-- wp:paragraph -->
<p>End group</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->WordPress information
- WordPress version: 5.7.3-alpha
- Gutenberg version: 11
- Are all plugins except Gutenberg deactivated? No
- Are you using a default theme (e.g. Twenty Twenty-One)? Yes, Twenty Twenty-One
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.

