Skip to content

Change the default visual box for OverflowClipMargin to PaddingBox #18935

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

Merged
merged 5 commits into from
Apr 30, 2025

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Apr 25, 2025

Objective

The default should be OverflowClipBox::PaddingBox not OverflowClipBox::ContentBox

padding-box is the default in CSS.

Solution

Set the default to PaddingBox.

Testing

Compare the overflow UI example on main vs with this PR. You should see that on main the outline around the inner node gets clipped. With this PR by default clipping starts at the inner edge of the border (the padding-box) and the outlines are visible.

Fixes #18934

@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide labels Apr 25, 2025
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

Copy link
Contributor

@Henauxg Henauxg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a link to a CSS spec for the default value: https://udn.realityripple.com/docs/Mozilla/Gecko/Chrome/CSS/overflow-clip-box
(Btw, it seems that overflow-clip-box is an obsolete CSS property, not supported in modern browsers)

UI overflow example

image

On main:
image

On this PR:
image

@Henauxg Henauxg added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 28, 2025
Copy link
Contributor

@NthTensor NthTensor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration guide looks good. Thanks!

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Apr 29, 2025

Found a link to a CSS spec for the default value: https://udn.realityripple.com/docs/Mozilla/Gecko/Chrome/CSS/overflow-clip-box (Btw, it seems that overflow-clip-box is an obsolete CSS property, not supported in modern browsers)

Yeah I think the visual-box settings are all just rolled into clip-path in modern CSS. We could call rename the enum to ClipPath but it seems a bit deceptive since we don't support arbitrary clipping shapes atm, only rectangles.

@mockersf mockersf added this pull request to the merge queue Apr 30, 2025
Merged via the queue into bevyengine:main with commit 21b62d6 Apr 30, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The default for OverflowClipMargin's visual box should be PaddingBox not ContentBox
5 participants