Style states: fix state deselection when selecting the already selected block - #81277
Conversation
|
Size Change: +17 B (0%) Total Size: 7.81 MB 📦 View Changed
|
|
Flaky tests detected in a8ee280. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31094135715 As a user I want to be able to create a navigation overlay for a specific navigation block in
|
ramonjd
left a comment
There was a problem hiding this comment.
Nice, neat fix. Tests well! When I click on the block with the hover state selected the state UI still shows in the inspector.
Everyone gets a video!!
Before
Kapture.2026-08-07.at.09.33.27.mp4
After
Kapture.2026-08-07.at.09.33.42.mp4
|
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 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. |
…ed block (#81277) Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: i-am-chitti <iamchitti@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.1 branch to get it included in the next release: e597aa3 |
What?
Fixes #81254, the selected style state was being lost whenever clicking into the already selected block.
How?
The bug was due to an incorrect case in the reducer for the selected style state. The
SELECTION_CHANGEaction usually dispatches astart.clientIdandend.clientId, not just aclientId. The reducer was not handling this.The code is now updated to preserve the selected state for single block selections if the selected block doesn't change.
Testing Instructions
In trunk: The 'Hover' state becomes deselected
In this PR: The 'Hover' state remains
Screenshots or screencast
Kapture.2026-08-06.at.11.37.10.mp4
Use of AI Tools
OpenCode / Codex