Skip to content

Fix Post Featured Image overflow in Group flex layouts with aspect ratio#77652

Open
Mustafabharmal wants to merge 1 commit intoWordPress:trunkfrom
Mustafabharmal:fix/post-featured-image-flex-overflow
Open

Fix Post Featured Image overflow in Group flex layouts with aspect ratio#77652
Mustafabharmal wants to merge 1 commit intoWordPress:trunkfrom
Mustafabharmal:fix/post-featured-image-flex-overflow

Conversation

@Mustafabharmal
Copy link
Copy Markdown
Contributor

What?

Closes #67430

Fixes an overflow issue where Post Featured Image can exceed its container width in Group flex layouts (Stack/Row) when an aspect ratio is set (for example 4/3 or 16/9).

Why?

The issue has been reproducible across multiple environments and browsers when Query Loop items include featured images with mixed source proportions and a wide aspect ratio. This breaks expected layout behavior in Stack/Row contexts.

How?

Adds a minimal, scoped style rule for Post Featured Image only when it is inside a Group flex layout:

  • Apply max-width: 100% in .wp-block-group.is-layout-flex context

This keeps the fix targeted to the problematic layout context and avoids broader style impact.

Testing Instructions

  1. Create or edit a post/page.
  2. Insert a Query Loop block.
  3. In Post Template, insert a Group block and set layout to Stack (or Row).
  4. Add Post Featured Image and set aspect ratio to 4/3 or 16/9.
  5. Use posts with varied featured image proportions (portrait, landscape, square).
  6. Confirm the featured image does not overflow in the editor.
  7. Preview on frontend and confirm no overflow there either.
  8. Verify Post Featured Image behavior outside Group flex layouts is unchanged.

Screenshots or screencast

Before: Featured image overflows in Stack/Row with wide aspect ratio

Before.css.fix.featured.image.mov

After: Featured image remains constrained within container

After.css.fix.featured.image.mov

Co-authored-by: Copilot <copilot@github.com>
@github-actions
Copy link
Copy Markdown

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @brokmech, @pshemek.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: brokmech, pshemek.

Co-authored-by: Mustafabharmal <mustafabharmal@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: beafialho <beafialho@git.wordpress.org>
Co-authored-by: henriqueiamarino <iamarinoh@git.wordpress.org>
Co-authored-by: rinkalpagdar <rinkalpagdar@git.wordpress.org>
Co-authored-by: iamtakashi <iamtakashi@git.wordpress.org>

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

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Apr 24, 2026
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Post Featured Image Affects the Post Featured Image Block labels Apr 25, 2026
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano 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 working on this! Let's explore the optimal approach from a broader perspective, rather than making specific modifications within a particular block. See #67430 (comment)

@t-hamano t-hamano added the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Post Featured Image Affects the Post Featured Image Block [Package] Block library /packages/block-library [Status] Blocked Used to indicate that a current effort isn't able to move forward [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stack Block: Featured images with aspect ratio set overflow

2 participants