Theme JSON: Define preset CSS vars for blocks based on feature selectors#10869
Theme JSON: Define preset CSS vars for blocks based on feature selectors#10869aaronrobertshaw wants to merge 5 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The test failure is related. This will need to be rebased after #10628 lands. Alternatively, I might be able to update the test to use an older preset in theme json, e.g. aspect ratio or something. If I go that route I'll update the Gutenberg PR to match |
81e988f to
027feba
Compare
|
I would appreciate it if you could proceed with this PR and commit it in time for the 7.1 Beta1 release on July 15. |
Backport of WordPress/gutenberg#75226 Updates the global styles engine to generate preset CSS custom properties on feature-specific selectors rather than only the block's root selector. This enables blocks whose root selector targets an inner element to have preset CSS vars output on the appropriate outer wrapper selector.
Co-authored-by: Weston Ruter <westonruter@gmail.com>
9a2cf73 to
0cc2bf5
Compare
|
@aaronrobertshaw This was prepped before 7.0 and probably punted by default. I've rebased and prepped things, but would like to know if it's okay to commit. |
Trac ticket: https://core.trac.wordpress.org/ticket/64598
This PR brings the changes from the following Gutenberg PR to core:
WordPress/gutenberg#75226
Description
Updates the global styles engine and theme JSON processing to generate preset CSS custom properties (vars) for blocks based on their feature-specific selectors rather than only the block's root selector. This enables blocks whose root selector targets an inner element to have preset CSS vars output on the appropriate outer wrapper selector.
See: WordPress/gutenberg#74242
Testing
phpunit --filter=WP_Theme_JSON_Testtest_get_stylesheet_preset_css_vars_use_feature_selectortest.dimensions.rootselector different from the block's root selector), definedimensionSizespresets for that block in theme.json, and confirm the CSS vars are output on the feature selector rather than the block's root selector.