Duotone: Use CSS variables instead of slugs in block attributes#48426
Conversation
|
Size Change: +410 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
getdave
left a comment
There was a problem hiding this comment.
Seems like a good change if all others blocks conform to storing such presets in the same format.
PS: I fixed the unit tests.
|
Flaky tests detected in 3e2a6cb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4264866292
|
This function is used externally, so we don't want to change the definition of the function
|
Testing this out and it's not applying duotone presets to featured images from custom styles applied to themes. Repro:
|
|
Debugging notes. Not sure why or what the fix would be, but here's the difference between this branch and trunk that I see for the featured image using custom style:
So, this branch: vs trunk: |
|
@jeryj The issue I think you're describing would be caused by what I mentioned in #48318 (comment) Could you try testing it prior to when #48318 was merged. We're trying to get those two changes in the same release so it won't cause issues. |
|
Tested it out prior to that commit, and it is working... ish. It has a filter applied but the filter colors aren't right. It sounds like you've got it though! |
ajlende
left a comment
There was a problem hiding this comment.
@jeryj I'm not seeing the issues you are.
Prior to #48318 I see this get saved in the block attributes: "style":{"color":{"duotone":["#000","#C9E4ED"]}. Then I switch to this branch and the old style attribute is still saved and properly rendered as if it was a custom duotone.
Re-selecting the filter switches to the new style attribute "style":{"color":{"duotone":"var:preset|duotone|blue-filter"} which should work when switching themes if the new theme has the same preset.
I'm going to merge this for now so it can be sure to make it into this release and I can make a follow-up if there is something I'm missing.
What?
If we save Duotone preset slugs in the style attribute, we should use the standard
var:preset|duotone|*syntax for consistency with other styles.Why?
Fixes an issue introduced in #48318
Resolves #48371
How?
Just prepend the slug with
var:preset|duotoneand then remove it again.Testing Instructions
Testing Instructions for Keyboard
Check that the image has a
filterCSS applied to it and there is an SVG that has a filter with the same id as as the one referenced in the CSS for the image.