Fix/adjust default colors to avoid conflicts in 5.7 #350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Somewhere between WP 5.4 and 5.7 new default colors of
white
andblack
were added.These conflict with our
light
anddark
themes IF the hex colors match (#ffffff
) for example. The block editor matches the color by the color value of the color object instead of it's slug. This can cause a bug in some cases where the wrong class name is then applied to the block because the first matching color in the colors object of registered colors isn't actually the color the user selected in the color palette component. When the wrong color class is assigned the wrong styling applies.For example if
light
andwhite
colors both have a color value of#ffffff
andwhite
is comes first in the overall color object beforelight
then when a user selects thelight
color swatch in the block editor, the classhas-color-white
is applied instead ofhas-color-light
.BU Blocks concats our custom colors with the default/existing registered colors so our
light
,dark
,primary
, etc are later items in the color object.This should be fixed by WP IMO. It doesn't make sense to match the colors up based on the color value instead of using the slug which is more unique. See more details of the error here: WordPress/gutenberg#9357