Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group block: border-radius attribute to achieve rounded edges only clips content on bottom but not on top #52559

Open
porg opened this issue Jul 12, 2023 · 3 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@porg
Copy link

porg commented Jul 12, 2023

Description

User Need

Reproduction

  1. Create a group
  2. Nest some blocks into it, Paragraph block, Bullet List block, Image block
  3. Give all of them a visible background-color
  4. Give the group a border-radius of e.g. 16px on all 4 edges (top-left, top-right, bottom-right, bottom-left)

Expected: You get 4 rounded edges. Content of the nested blocks is clipped on all 4 edges.

Actual: Only the bottom-left and bottom-right edge get rounded and clip their content.

Attempted workarounds: Tried with various blocks (Paragraph, Bullet List, Image block, 3rd party Gutenslider block). Also tried themself alone, or wrapped within another group. Did not help. On the top the sharp edges always remained. Content was not clipped.

WordPress.Group.block.-.Border.Radius.attribute.to.achieve.rounded.edges.only.clips.content.on.bottom.but.not.on.top.mp4

Environment

  • WordPress 6.2.2
  • Gutenberg plugin 15.9.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@porg
Copy link
Author

porg commented Jul 12, 2023

Workaround: CSS helper classes

.has-overflow-hidden { overflow: hidden;  }
.has-rounded-edges-30 { overflow: hidden; border-radius: var(--wp--preset--spacing--30); }
.has-rounded-edges-40 { overflow: hidden; border-radius: var(--wp--preset--spacing--30); }
  • In the Block Editor select the Column block or Group block which needs rounded edges on all 4 sides.
  • Inspector → Advanced → Additional CSS class(es) → Add the appropriate helper class(es).

@t-hamano
Copy link
Contributor

@porg

Thanks for submitting the issue.

I think this problem would occur in all orientations, whether above or below. As seen in the CSS helper class you presented, the solution to this problem would be to apply overflow:hidden in the block to which the border-radius is applied. However, it would need to be thoroughly tested to ensure that it does not cut off something unintended.

I would mark this issue as an enhancement, not a bug.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json CSS Styling Related to editor and front end styles, CSS-specific issues. labels Jul 12, 2023
@porg
Copy link
Author

porg commented Jul 12, 2023

  1. It is okay that you changed the type from bug to enhancement.

  2. Thanks for the input what was the exact missing attribute. Updated my above comment to differentiate between the current state of Column (no border-radius UI controls at all, see Columns Block > allow border radius on columns #41345 ) and Group (just needs overflow:hidden so that the UI option border-radius gets really into effect).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants