Skip to content

Media & Text Block: Image not rendered properly on frontend when inside stack #68609

@Mayank-Tripathi32

Description

@Mayank-Tripathi32

Description

When a Media Text block is created within a stack and an image is added without accompanying text, the block renders correctly in the editor. However, on the frontend, it is rendered without a defined width, causing the image to be hidden.

Expected Behavior

The image should be rendered with an appropriate width, making it visible on the frontend, even if no text is present.

Actual Behavior

The image is rendered without a defined width, causing it to be hidden on the frontend.

Please Note

I am working on the issue, discovered while working on #65605. Only happens with block themes.

Step-by-step reproduction instructions

  1. Add a Media Text block inside a Stack block.
  2. Upload or select an image for the Media Text block.
  3. Leave the text field empty and Enable crop to fit.
  4. Preview the frontend of the page.

Screenshots, screen recording, code snippet

Frontend

Image

Editor

Image

Environment info

WordPress version: 6.7
Browser(s): Safari, Chrome
OS: MAC

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

Metadata

Metadata

Labels

[Block] Media & TextAffects the Media & Text Block[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions