Opened 2 days ago
Last modified 21 hours ago
#66313 new enhancement
Block Supports: Output per-block styles for custom style states
| Reported by: | onemaggie | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Cc: | Focuses: |
Description
Block style states can style a Navigation Link's current menu item (-current) in theme.json, and Gutenberg now lets you set that state per block too. This adds the matching per-block CSS output to the states block support, scoped to the selector the block declares in selectors.states.
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/78769
Change History (2)
This ticket was mentioned in PR #14285 on WordPress/wordpress-develop by @onemaggie.
2 days ago
#1
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Backport of Gutenberg PR https://github.com/WordPress/gutenberg/pull/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