Skip to content

Responsive visibility does not work for blocks without a wrapper tag, such as custom HTML blocks. #76128

Closed

Description

@shimotmk

Description

The responsive hide feature uses media queries. If there is no wrapper tag, the class is not added, and the hide CSS will not be applied.

A support flag like

"visibility": {
  "viewport": false
}

might be necessary in block.json's supports property.

This feature will be introduced from WordPress 7.0, so a backport might be necessary.

Step-by-step reproduction instructions

  1. Go to post or page.
  2. Insert custom html block.
  3. Hide on Desktop
  4. You will see that the content of the custom HTML block is displayed on desktop as well.

Screenshots, screen recording, code snippet

visible.mp4

Environment info

  • WordPress beta 2

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    [Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi
    on Mar 4, 2026
  2. sagarjadhav commented on Mar 4, 2026

    @sagarjadhav
    Contributor

    I was able to reproduce this issue on WordPress 7.0 Beta.

    After reviewing the core/html block implementation, I confirmed that:

    • It disables className support.
    • It does not render a wrapper element in save.
    • Viewport visibility relies on wrapper-level class injection, so the responsive hide CSS has no DOM target.

    I tested explicitly disabling viewport visibility support by adding the following to packages/block-library/src/html/block.json:

    "visibility": false

    After rebuilding:

    • The visibility controls no longer appear for the Custom HTML block.
    • Other blocks continue to support viewport visibility as expected.
    • No frontend markup changes were introduced.

    I’ve opened a PR implementing this approach for review: #76138. Happy to adjust if a different direction is preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions