Media & Text: clip media to block border-radius using overflow: clip#77951
Media & Text: clip media to block border-radius using overflow: clip#77951druesome wants to merge 1 commit intoWordPress:trunkfrom
Conversation
When a border-radius is applied to the block (via block controls or Global Styles), the inner media element overflows the rounded corners rather than being clipped by them. The cover block already solves the same problem using overflow: hidden as a fallback and overflow: clip as the preferred value (so that position: sticky still works on child elements). Apply the same approach to .wp-block-media-text. This is a CSS-only fix — no save.js changes, no deprecated block version required. The clip applies regardless of whether border-radius comes from an inline style or Global Styles. Fixes WordPress#69596
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @andrew.dela.serna@a8c.com. 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. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @druesome! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Tested the fix locally on a WordPress Studio site (WP 6.7 + Jetpack 15.7.1). Frontend — Editor — the editor loads from the aggregated Screenshot showing before/after in the editor would follow but the fix is confirmed working on both surfaces. |
|
Heads up — I don't have label permissions as an external contributor. Could a maintainer add |
What?
When a
border-radiusis applied to the Media & Text block (via block controls or Global Styles), the inner media element overflows the rounded corners rather than being clipped by them. This affects both the frontend and the block editor canvas.Fixes #69596
Related: EDI-481 (Automattic internal issue tracker)
Why?
The block applies
border-radiusto the outer.wp-block-media-textcontainer, but the inner<figure>and its image/video overflow the rounded corners because there is nothing clipping them.How?
The cover block already solves the exact same problem using
overflow: hiddenas a fallback andoverflow: clipas the preferred value —overflow: clipis preferred because it does not create a new block formatting context, meaningposition: stickycontinues to work on child elements (unlikeoverflow: hidden).Apply the same two-line pattern to
.wp-block-media-textinstyle.scss:This is a CSS-only fix:
save.jschanges → no new deprecated block version requiredstyle.scsssource — frontend viawp-includes/blocks/media-text/style.css, editor via the aggregatedwp-includes/css/dist/block-library/style.css)Testing Instructions
appearanceToolsenabledis-image-fill-element) variant — confirm it also clips correctly🤖 Generated with Claude Code