-
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
Social Icons: Preset colors do not stay in sync with Global Styles presets #35480
Comments
I don't recall the original rationale for the |
gutenberg/packages/block-library/src/social-links/edit.js Lines 172 to 174 in b1d8f7a
The reason this bug happens is because Social Links passes the fallback attributes ( gutenberg/packages/block-library/src/social-links/block.json Lines 36 to 40 in b1d8f7a
One fix for this would be to pass down both the primary and fallback attributes so that the Social Link block can set the colour to Another fix could be to remove the fallback attributes altogether and only use the primary attributes. This is what #29565 does, which should fix this bug. I'm not sure if the fallback is necessary? Do we do it for other blocks? It would be good if Social Links can use the attributes that setting |
Sorry I'm late to the conversation on this!
From memory, the issue regarding the loss of a named color selection when switching themes was raised in the review of the PR implementing the color options for the social links block. I don't feel strongly about maintaining this behaviour.
The current colors implementation for the social links was added before we had the ability to skip serialization of block support styles. There was plenty of discussion on the original PR around applying colors at an individual level vs once only on the primary social links block. It was the desire to have the colors set only once that ultimately drove the context-based approach. Initially, CSS variables were used to pass the colors down however that ran into some issues with KSES. This block was a driving force in evolving the
Agreed. I'm happy to help out with reviews or pick up #29565 once 5.9 is released. I was under the impression that particular PR was still waiting on the ability to define custom labels but would need to follow that thread further. |
Noting here that this is also an issue when you're trying to update the color of the icons in a style variation. Although |
+1 I don't understand why |
This issue is now fixed in #51020 |
When you assign a preset color to the Social Links block, it records the preset's hex color in the markup like so:
If someone were to go and modify the value of that
foreground
preset via Global Styles, the social links block does not update to the new color value. The original hex color defined in the block markup is still used.GIF:
Note that I'm changing the color of "foreground" via Global Styles, but that update is not reflected in the Social Links block color:
Gutenberg version 11.7.0-rc.1
Noticed during the development of Twenty Twenty-Two: WordPress/twentytwentytwo#74 (comment)
The text was updated successfully, but these errors were encountered: