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

Fix/adjust default colors to avoid conflicts in 5.7 #350

Conversation

acketon
Copy link
Member

@acketon acketon commented Jul 27, 2023

Somewhere between WP 5.4 and 5.7 new default colors of white and black were added.

These conflict with our light and dark 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 and white colors both have a color value of #ffffff and white is comes first in the overall color object before light then when a user selects the light color swatch in the block editor, the class has-color-white is applied instead of has-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

@acketon acketon self-assigned this Jul 27, 2023
Copy link

@hirozed hirozed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta love obfuscated javascript.

@acketon acketon merged commit a3d5030 into wp-upgrade/5.7-base-compatibility Jul 28, 2023
@acketon acketon deleted the fix/adjust-default-colors-to-avoid-conflicts-in-5.7 branch July 28, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants