Skip to content

Flex Layout: Fix fixed-width child blocks being compressed - #77749

Closed
dpmehta wants to merge 2 commits into
WordPress:trunkfrom
dpmehta:fix/flex-child-fixed-width-compression
Closed

dpmehta wants to merge 2 commits into
WordPress:trunkfrom
dpmehta:fix/flex-child-fixed-width-compression

Conversation

@dpmehta

@dpmehta dpmehta commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #63218

This PR adds flex-shrink: 0 to child blocks set to a "Fixed" width within a flex (Row) layout to prevent width mismatch issue.

Why?

When a child block is set to a "Fixed" width, it generates a flex-basis value. However, because flex-shrink defaults to 1 in CSS, When adjacent "Fit" blocks have long content that fills the container, these blocks are frequently compressed below their intended size. The provided fixed width is strictly applied when flex-shrink: 0 is added.

How?

Modified the layout block support logic to include flex-shrink: 0 whenever selfStretch is set to fixed.

Testing Instructions

  1. Open a post or page.
  2. Insert a Row block.
  3. Add two Paragraph blocks with long text.
  4. Select the first paragraph and set Dimensions > Width to Fixed (e.g., 200px).
  5. Leave the second paragraph set to Fit.
  6. Verify in both the editor and on the frontend that the first paragraph remains at 200px and is not compressed by the second paragraph.

Screenshots or screencast

Before Fix

before-fix.mov

After Fix

after-fix.mov

Use of AI Tools

AI assistance is used to draft PR description.

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Apr 28, 2026
@dpmehta dpmehta closed this May 4, 2026
@dpmehta dpmehta reopened this May 4, 2026
@dpmehta
dpmehta force-pushed the fix/flex-child-fixed-width-compression branch from a7652b8 to efc66a3 Compare May 4, 2026 10:50
@youknowriad

Copy link
Copy Markdown
Contributor

Thanks for working on this, @dpmehta! "Fixed" width for flex children is now truly fixed thanks to #79073, which also adds a "Max width" option for the old behavior, and #63218 has been closed. Closing this draft as superseded; feel free to reopen if you see a case that's still compressed.

@youknowriad youknowriad closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Row block: setting dimensions width as fixed in only one child block produces wrong results

2 participants