Block Editor: Deprecate block hovered global state#70731
Conversation
|
Size Change: -22 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in ee0e2f4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16294048074
|
packages/block-editor/src/components/block-list/use-block-props/use-is-hovered.js
Outdated
Show resolved
Hide resolved
|
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. |
| export function getHoveredBlockClientId( state ) { | ||
| return state.hoveredBlockClientId; | ||
| } |
There was a problem hiding this comment.
I'm in two minds about removing the action/selectors completely. Not sure if an option might be to have it return undefined and log a deprecation message. It at least prevents the editor from blowing up completely.
The action could do the same (not dispatch anything), though I'm not sure if an action returning undefined is an issue - would it be ignored?
There was a problem hiding this comment.
I was also hesitant about removing these vs deprecation. But here's why I decided to do so:
- The
https://wpdirectory.net/returns no results for them. - These actions/selectors shouldn't have been made public in the first case.
- The revert should've happened in Only show zoom out inserters on block selection #65759, but that ship has sailed :(
There was a problem hiding this comment.
@talldan, added changelog entry and marked this a breaking change.
There was a problem hiding this comment.
The https://wpdirectory.net/ returns no results for them.
I don't think this is completely exhaustive, which is why I'm hesitant about it. There's also plugins outside the repo and custom code added to individual sites that it doesn't cover.
I agree though, I can't imagine anyone using the APIs.
Alternative compromise could be to keep the functions with deprecations for a few releases, then follow up and remove them after a couple of plugin releases with the deprecation message active.
|
Thanks, @talldan! I restored the action/selector and added deprecation warnings; there's no need to risk breakage. We should be more careful when introducing new public APIs in the future. |
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org>
What?
PR reverts block hovered global state from the block editor package, introduced in #63668.
Why?
Testing Instructions
is-hoveredstyle is correctly applied to the block wrapper. This can be checked via DevTools.Testing Instructions for Keyboard
Same.