Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@PPakalns
Copy link
Contributor

@PPakalns PPakalns commented Nov 14, 2025

Objective

Implement UI nodes that can ignore parent node clipping restrictions, but still are restricted by grandparent node clipping restrictions.

Useful for creating scroll-areas that utilize scrollbar-width provided by taffy. Using IgnoreParentClip it is possible to avoid two element hierarchy requirement for scroll-areas. Instead scrollbar overlay can be inserted as child element with position: absolute; width: 100%; height: 100%; z-index: 1; ignore-scroll: true. Then scrollbars can be inserted inside this overlay element. If we want to place scrollbars on space provided by scrollbar-width, negative offset is needed, e.g. right: -8px. This goes outside clipping rect of scrollarea. Therefore functionality to ignore parent element clipping rect is needed.

Solution

Introduce IgnoreParentClip component that instructs clipping rect calculations to use grand parent clipping rect in calculations for ui entities with this component.

Testing

  • Created scrollareas in personal project that are dynamically added to overflowing elements without requiring special multi level scrollarea hierarchy. (Current bevy examples requires wrapper element that defines 2x2 grid).

@PPakalns PPakalns marked this pull request as ready for review November 14, 2025 10:44
@PPakalns
Copy link
Contributor Author

Can be used to implement scrollarea that utilizes taffy scrollbar_size:

scroll-area-auto-attached.mov

@rossleonardy
Copy link
Contributor

Is OverrideClip not suitable? With the scrollbar it basically seems like just exiting clipping altogether is an adequate solution––What is the situation where you want the grandparents clipping box to affect the element but not the parents?

@PPakalns
Copy link
Contributor Author

@rossleonardy

In case of OverrideClip
For example in provided video. Floating window content has overflow: clip. If I reduce width of the window, scrollbar will float outside the window (is not clipped),which doesn't look good.

Another option would be to set Node overflow_clip_margin. But that has the same problem, if I increase the size of clip rect it can grow outside grandparent clipping rect and would result in scrollbar floating outside the floating window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants