Feature/block visibility theme json opt out#76559
Draft
Conversation
Adds responsive.blockVisibility to theme.json schema Hides block visibility toolbar when theme.json sets responsive.blockVisibility: false Hides block visibility menu item when theme.json sets responsive.blockVisibility: false Gates keyboard shortcut and command palette for responsive.blockVisibility
67c6dda to
c93bc1c
Compare
3 tasks
|
Size Change: +130 B (0%) Total Size: 8.75 MB
ℹ️ View Unchanged
|
Contributor
|
Thank you for working on this. In my opinion it should survive theme switch. |
|
Flaky tests detected in bb2170e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23179700348
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What? How? Why?
Adds
settings.responsive.blockVisibilitytotheme.json, allowing themes to disable the block visibility feature entirely.{ "settings": { "responsive": { "blockVisibility": false } } }When set to
false, the toolbar button and block options menu item are hidden.In this regard, it makes this block support consistent with
color,typographyetc.This PR also adds
settings.responsiveas a new top-level namespace intheme.json, which is the intended home for the configurable breakpoints work that follows.Limitations
Per-block overrides via
settings.blocks["core/group"].responsive.blockVisibilityare not yet fully implemented in this PR.E.g.,
Questions
So far, the settings in this PR affect the UI-only.
So content, that is, the saved
blockVisibilityattribute, survives theme switches. This is consistent with other block supports.Because theme switching is non destructive, blocks that have been hidden previously will still contain their visibility attributes in themes that do not support
blockVisibility.Because of this, I've left the markers in the list view and block inspector sidebar intact.
However, should block visibility attributes survive theme switches? Is block visibility an editorial property (belongs to the content, survives theme switches) or a presentational property (belongs to the theme relationship, should be re-evaluated on switch)?
If the latter, we could update this PR to keep the attributes, but ignore them, e.g., render all blocks as if they had no rules.
Testing
theme.json:{ "settings": { "responsive": { "blockVisibility": false } } }"blockVisibility": falseand reload. Confirm the block is still hidden on the frontend.Screenshots
Before
Kapture.2026-03-17.at.15.33.53.mp4
After
Kapture.2026-03-17.at.15.46.54.mp4