Repository navigation
Embed: Add minimum width and height support - #83903
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +104 B (0%) Total Size: 8.29 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. sort patterns (Site Editor v2) in
|
febed13 to
0b3b294
Compare
0b3b294 to
bc2958e
Compare

Related: #43241
What?
Adds minimum width and minimum height support to the Embed block.
Why?
The Embed block supports margin, but has no dimensions controls. This brings it in line with other blocks as part of the design tools consistency work.
A minimum keeps an embed from collapsing to a sliver in a narrow column, and gives a site one place to set a floor for every embed through Global Styles.
Width, height and aspect ratio are deliberately left out and handled later in this process.
How?
Adds
dimensions.minHeightanddimensions.minWidthto the block'sblock.jsonsupports. The block saves its wrapper throughuseBlockProps.save(), so the supports serialize with no PHP change.The block's stylesheet already sets two minimums on
.wp-block-embed, and both beat a Global Styles value on specificity:.wp-block-cover .wp-block-embedsetsmin-width: 320pxandmin-height: 240pxso an embed does not collapse inside a Cover..wp-block-group.is-layout-flex .wp-block-embedsetsmin-width: 0so an embed can shrink inside a Row or Stack.Both are wrapped in
:root :where(), matching Global Styles specificity, so a user value now wins on source order. The values are unchanged and stay the default.flex: 1 1 0%stays on the original selector, so flex behaviour is untouched. This follows the same approach as #83609 for Verse.The tradeoff:
min-width: 0stops an embed blowing out a Row or Stack. With it lowered, a Global Styles minimum width larger than the space available pushes the embed past the row, as testing step 7 shows. That is intended, a user value should win, but it is a change in what a site can break.The core blocks reference and the block's
README.mdare regenerated to listdimensions (minHeight, minWidth).In the screenshots the tinted card with a hairline edge, the 200px content column and the outlined paragraph are a capture aid, not part of the change. The block gains no background or border. The YouTube embed is responsive, so the video fills the card and its 4:3 height is usually taller than the minimum height; the minimum height shows as the tinted strip under the video in the block mobile state.
Testing Instructions
Setup: a post with a YouTube Embed block, followed by a plain paragraph.
300px, minimum height140px.250px, minimum height100px.560px, minimum height340px.300px, minimum height240px.Cover and Row cases, before and after this change:
200px, minimum height120px.Screenshots or screencast
Use of AI Tools
Implemented, built and screenshotted by a Claude Code agent from a predefined task.