WordPress / wporg-parent-2021

17 stars 10 forks source link

Custom link colors are not applied #135

Closed ryelle closed 4 months ago

ryelle commented 4 months ago

Reported in slack, I looked into this a little— it looks like custom link colors are not being applied to the right elements. I can't replicate this locally, so it may be related to caching?

The colors here are all applied with the editor's custom link colors, which generates CSS like .wp-elements-0399dfb059d8cb526109866756d85380 a:where(:not(.wp-element-button)){color:var(--wp--preset--color--white);, but there is no matching .wp-elements-0399dfb059d8cb526109866756d85380 element.

Has anything changed with how Gutenberg generates those style classes?

Screenshots

This is affecting all the redesigned sites:

Main: The release page— credit links and "Get Started" should be white. Screen Shot 2024-05-04 at 15 53 09

Developer: The "More resources" and "Related" links should be a lighter blueberry. Screen Shot 2024-05-04 at 15 53 21

Documentation: The links next to "Get more help" should be white. Screen Shot 2024-05-04 at 15 53 33

ryelle commented 4 months ago

This seems to be because there are two wp-elements classes being generated for these sections, but gutenberg_render_elements_class_name only matches and applies one of them (the one that's not connected to anything). I cannot figure out why we have two classes being generated though, or when the other one is generated.

Ah… I couldn't replicate it locally because my version of WP was too old. The issue is that this code has already been backported to core, and the wp_render_elements_support_styles function is attached to a different hook now, so the remove_filter call in Gutenberg isn't unattaching the filter anymore.

This should be fixed in 18.3 with https://github.com/WordPress/gutenberg/pull/59538.

Until then, I've added a simple fix in wporg-mu-plugins to remove the filter. Gutenberg is always active, so it's safe to remove the core filter. We can remove this in a few days when 18.3 rolls out.