-
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
Make sure theme color palette presets are output when appearance tools are enabled. #57190
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/global-styles-and-settings.php |
Nice work tracking this bug down! To test I added new Group/Code/Image/Cover/Details/Columns/Search blocks all with a mixture of border styles inc. preset and custom colors. On trunk, where a preset color has been used, the color will not be output on the frontend. This PR fixes that 🎉
I also checked: ✅ No other preset styles, such as text/background, are affected If possible, adding unit test coverage for this test case (core tests here for reference) would be great to guard against any regressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work tracking this bug down!
+1, I like the way the condition is guarded, too, it means we're really only outputting these additional styles when we know that the theme wants them 👍
This is testing nicely with a variety of Classic themes with custom and preset colors, and I didn't run into any regressions:
TwentyTwenty | TwentyTwentyOne |
---|---|
LGTM! ✨
I just realised that as of 6.3 there's a dedicated border support that we should probably consider here. From @carolinan's testing instructions it seems that the issue this PR fixes was known at the time but wasn't considered to be a bug. |
Oh, good find! In the case of |
Yes, because if we only check for |
Sounds good to me 👍 |
@ramonjd do you mean adding coverage for this change to the core unit tests as part of the sync PR? I notice that there isn't a unit test for this function in Gutenberg, probably to avoid duplication? |
OK I've updated this to address border support as well as appearance-tools, and edited the PR description accordingly. |
Flaky tests detected in da5ad04. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7269288876
|
Either / Or. If it's easier to do it in the Core patch, which it probably is, then 👍🏻 Otherwise we'd have to scaffold the test suite again in Gutenberg just for a single assertion 😄 So LGTM as is 🚢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just re-rested with border
and appearance-tools
separately, and this is still testing nicely! 🎉
…s are enabled. (#57190) * Make sure theme color palette preset styles are output. * Check for color palette support * Also check for border support.
This comment was marked as resolved.
This comment was marked as resolved.
✅ I updated this PR with the |
What?
Partially addresses #56131, namely
When outputting preset styles based on color palettes, only the
default
palette is used unless the theme supportstheme.json
.But it is possible for classic themes to define color palettes as a theme support, and it is also possible for themes to add support for appearance tools, or just for border, which enables design tools such as border that will leverage the theme color palette for their presets. This means that, if both color palette and either appearance tools or border are supported by the theme, theme preset styles should be output in addition to defaults.
Note: currently appearance tools support in themes is limited to Gutenberg. There was an attempt to add this feature to core, which was reverted because not all tools worked well with classic themes. This PR is a step towards addressing these issues so that support for appearance tools can be re-enabled in core.
Testing Instructions
add_theme_support( 'appearance-tools' )
to the setup function of a classic theme.add_theme_support( 'border' )
instead of appearance-tools.Testing Instructions for Keyboard
Screenshots or screencast