Component's Popover Toolbar simplified for Tablet/Mobile blocks
Description
This is related to issue #73776: WordPress 7.0: add option to hide blocks based on screen size.
The Popover Toolbar is vastly reduced for Tablet/Mobile blocks.
While the Desktop-enabled versions have options like AI Assistant, Add Animation or Align Text, these options are removed if the Block is hidden on Desktop
Step-by-step reproduction instructions
- Make sure you're using WordPress 7.0 or above
- On the Editor add a paragraph block. Confirm that the "Align Text" or "AI Assistant" options are displayed on the Popover Toolbar
- Hide the block on Desktop, so that it's only visible on Tablet and Mobile
- The extra options on the Popover Toolbar are gone
Screenshots, screen recording, code snippet
Environment info
- WordPress 7.0
- Chrome
- MacOS
Please confirm that you have searched existing issues in the repo.
- [x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- [x] Yes
Please confirm which theme type you used for testing.
- [x] Block
- [ ] Classic
- [ ] Hybrid (e.g. classic with theme.json)
- [ ] Not sure
I don’t think this is a bug, since the behavior appears to be intentional based on the discussion in #75335.
As mentioned there, this was introduced because “when a block is hidden on the current viewport (e.g., hidden on mobile while previewing mobile), editing its alignment, formatting, or other visual properties isn't meaningful — the block won't be rendered for that viewport.”
That reasoning makes sense from a UX perspective. However, I also see the concern raised here. Even if a block isn’t visible in the current viewport, users may still want to configure properties like alignment or layout in advance for that context.
So this feels less like a clear bug and more like a UX trade-off:
- Current behavior: prevents editing when the block isn’t visible (avoids confusion)
- Alternative expectation: allow editing regardless of visibility (supports forward configuration)
I’m open to discussing what the expected behaviour should be here.
Thanks for the suggestion.
“when a block is hidden on the current viewport (e.g., hidden on mobile while previewing mobile), editing its alignment, formatting, or other visual properties isn't meaningful
The most challenging point is that any control can be injected into the toolbar slot by consumers, and we cannot predict whether these controls will visually alter the block. Developers might be injecting buttons to control some metadata that doesn't visually impact the block.
As an intermediate approach, instead of hiding all toolbar button groups, we could also consider hiding only the toolbar groups that are clearly unnecessary. For example, the inline group would be clearly unnecessary since it's meant for text editing.
cc @ramonjd @jasmussen
these options are removed if the Block is hidden on Desktop
Related:
- https://github.com/WordPress/gutenberg/issues/73838
If we can work out a way to depict hidden blocks in the editor, I think this issue would be moot. We wouldn't have to make micro decisions for every block tool based on best guesses.
Even a setting or toggle, I don't know really. I have a bias towards showing the block, so I won't say more 😄
As mentioned there, this was introduced because “when a block is hidden on the current viewport (e.g., hidden on mobile while previewing mobile), editing its alignment, formatting, or other visual properties isn't meaningful — the block won't be rendered for that viewport.”
Noting that on the screenshots posted above, the "Tablet" Toolbar is hidden even while the viewport is indeed Tablet. So although the block was visible in that viewport, the Toolbar wasn't displayed.
What's more, I did one more test, and the full Toolbar is displayed on Desktop even if Desktop is hidden. And the Toolbar is hidden on Tablet/Mobile even when they are shown for that viewport.
Here's an example of a Hidden Desktop block displaying the full Toolbar:
I don't personally have a strong opinion whether the toolbar needs to be changed or not (other than the eye indicator), based on visible/hidden status, personally. I'll defer to folks present.
The most challenging point is that any control can be injected into the toolbar slot by consumers, and we cannot predict whether these controls will visually alter the block. Developers might be injecting buttons to control some metadata that doesn't visually impact the block.
If we can work out a way to depict hidden blocks in the editor, I think this issue would be moot. We wouldn't have to make micro decisions for every block tool based on best guesses.
Based on these points, I think it would be best to revert https://github.com/WordPress/gutenberg/pull/75335 for the 7.0 release.