Add supports for pseudo selectors states on single block instances#76491
Add supports for pseudo selectors states on single block instances#76491MaggieCabrera wants to merge 12 commits intotrunkfrom
Conversation
|
Size Change: +1.24 kB (+0.02%) Total Size: 7.73 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in d4e46a5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23678896294
|
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @onetrev, @simonwammerfors, @davewhitley, @itsdavidmorgan, @le-sgs. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Replace the $found flag and double WP_HTML_Tag_Processor instantiation with a single processor using if/elseif branching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
BlockStyleControls renders the same 5 panels twice — once for default state, once for non-default. Since every panel already defaults selectedState to 'default', you can always pass it and render once: |
|
Every panel (color, border, typography, dimensions, background) has near-identical boilerplate: check selectedState, read from style[selectedState], create a state-scoped onChange, wrap the resetAllFilter. Can we extract a shared hook? |
|
Can the “Show state on canvas” toggle live inside the state dropdown rather than requiring its own SlotFill? |
|
Since |
What?
Closes #38277
Follow up of #75627
Adds experimental support for styling blocks in different interactive states (hover, focus, active) on a per-block basis.
Why?
Right now, hover/focus/active styles for blocks like Button can only be set in Global Styles. There's no way to give a single Button block its own hover color without changing every button on the site. This adds that ability.
How?
Blocks can opt in by declaring
"__experimentalStates": [":hover", ":focus", ":active"]in theirblock.jsonsupports. The Button block is the first to use this.In the editor:
On the frontend (PHP):
.wp-states-IDclass for this on the selector defined in block.jsonTesting Instructions
Screenshots or screencast
Use of AI Tools
This PR was authored with Claude Code (Claude Opus 4.6).