Repository navigation
Editor: Output per-block styles for custom style states - #14285
MaggieCabrera wants to merge 1 commit into
Conversation
Lets a block's `style` attribute style a custom state, such as Navigation Link's `-current` for the current menu item, including its nested pseudo states and inside a viewport. The per-block rules scope the block's `wp-states-*` class to the selector the block declares in `selectors.states`, wrapped in `:is()`, so a feature selector keeps the state on the block's wrapper. Backports WordPress/gutenberg#78769. See #66313. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Links WordPress/wordpress-develop#14285, which backports the custom state output in `lib/block-supports/states.php`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 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. |
Links WordPress/wordpress-develop#14285, which backports the custom state output in `lib/block-supports/states.php`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backport of Gutenberg PR WordPress/gutenberg#78769
Trac ticket: https://core.trac.wordpress.org/ticket/66313
A block's
styleattribute can now style a custom state, such as Navigation Link's-currentfor the current menu item, including its nested pseudo states and inside a viewport. The per-block rules scope the block'swp-states-*class to the selector the block declares inselectors.states, wrapped in:is(), so a feature selector keeps the state on the block's wrapper:.wp-states-1a2b3c4d:is(.wp-block-navigation .current-menu-item) > .wp-block-navigation-item__content.This PR backports:
wp_get_custom_state_selector_suffix()andwp_get_custom_state_style_rules(),wp_render_block_states_support(),Use of AI Tools
Ported with Claude Code (Opus 5.5). All output reviewed and validated by the author.
🤖 Generated with Claude Code