Skip to content

Conversation

@yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Apr 2, 2025

What?

Closes #68711

This PR fixes a regression, likely introduced in #56914, that restores the visualizer's behavior of hiding the Block Toolbar when the Block Interface is hidden.

Why?

An additional isBlockInterfaceHidden() check seems to have been omitted here:

How?

A check for ! isBlockInterfaceHidden() was added while determining _showBlockToolbarPopover.

Additional Context

If we choose not to fix this regression, we should at least clean up the following unused code:

  • The global state is updated via hideBlockInterface and showBlockInterface, but this serves no purpose since isBlockInterfaceHidden() is currently unused.

const { hideBlockInterface, showBlockInterface } = unlock(
useDispatch( blockEditorStore )

Testing Instructions

  1. Create a block.
  2. Try adjusting its margin.
  3. Confirm that the Block Toolbar hides when changing margins.

Testing Instructions for Keyboard

Same.

Screencast

pr

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review April 2, 2025 11:14
@yogeshbhutkar yogeshbhutkar requested a review from ellatrix as a code owner April 2, 2025 11:14
@github-actions
Copy link

github-actions bot commented Apr 2, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: stokesman <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: Mayank-Tripathi32 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@stokesman stokesman added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor labels Apr 2, 2025
Copy link
Contributor

@stokesman stokesman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! As a nitpick, ! isBlockInterfaceHidden() could be first in the list of conditions so when it evaluates to false it short-circuits the rest of them.

I agree with restoring this functionality because it does seem to have been unintentionally removed. That said, after testing, I do find it can feel a little distracting or mysterious in some cases. I guess mainly when there are no padding values to visualize but the block toolbar hides anyway. This and a few other details are covered in #45503 but I’m not suggesting we pursue any of that in this PR.

@yogeshbhutkar yogeshbhutkar force-pushed the fix-68711/block-tools branch from 0ac6ba2 to f258d24 Compare April 3, 2025 04:27
@yogeshbhutkar
Copy link
Contributor Author

Thanks for the review, @stokesman! I've implemented the suggested changes. As a follow-up to this PR, I'd like to work on the enhancements outlined in #45503.

@Mamaduka
Copy link
Member

Mamaduka commented Apr 3, 2025

Thanks for working on this, @yogeshbhutkar!

@Mamaduka Mamaduka merged commit 8c8d1ca into WordPress:trunk Apr 3, 2025
59 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.7 milestone Apr 3, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…dden (WordPress#69795)

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: stokesman <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: Mayank-Tripathi32 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Block Toolbar should not render when interacting with Dimension Controls

3 participants