Skip to content

Update ComputedNode for scrollbar thumbs in update_scrollbar_thumb#23612

Merged
alice-i-cecile merged 17 commits into
bevyengine:mainfrom
ickshonpe:thumb
Apr 2, 2026
Merged

Update ComputedNode for scrollbar thumbs in update_scrollbar_thumb#23612
alice-i-cecile merged 17 commits into
bevyengine:mainfrom
ickshonpe:thumb

Conversation

@ickshonpe

@ickshonpe ickshonpe commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Objective

Update ComputedNode for scrollbar thumbs in update_scrollbar_thumb to avoid delays and system ambiguities.

Solution

  • Removed Node from scrollbar thumb node entities.
  • Renamed CoreScrollbarThumb to ScrollbarThumb.
  • ScrollbarThumb now requires all the UI components and gains border and border_radius fields.
  • update_scrollbar_thumb now updates ScrollbarThumb node's UiGlobalTransform and ComputedNode in PostLayout.

Testing

cargo run --example scrollbars

We need a better scrollbars example, added an issue #23622.

…b` requires all the UI components and gains a `border_radius` field. `update_scrollbar_thumb` updates its `UiGlobalTransform` and `ComputedNode` in `PostLayout`.
@alice-i-cecile
alice-i-cecile requested a review from viridia March 31, 2026 22:22
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 31, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Mar 31, 2026
@alice-i-cecile
alice-i-cecile requested a review from kfc35 March 31, 2026 22:23
Comment thread crates/bevy_ui_widgets/src/scrollbar.rs
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 1, 2026
Comment thread crates/bevy_ui_widgets/src/scrollbar.rs
@micttyoid

micttyoid commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Can we have this "after" PostLayout? #23346
This does not have ambiguity with text systems and ComputedNode

@kfc35 kfc35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that I understand the logic, this looks fine to me.
Also checked out the branch and the example looks fine.

I think it’s fine to merge with all those requirements from node merged in to ensure correctness, but I will say that I tested the example while removing BackgroundColor, BorderColor, and ScrollPosition, and the example looks fine, so that may be a sign that those are OK to remove.

I think you should probably answer @micttyoid since it still seems there may still be ambiguities by placing update_scrollbar_thumb in PostLayout. After that, this is probably OK to merge?

Comment thread examples/ui/scroll_and_overflow/scrollbars.rs Outdated
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Apr 2, 2026
@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Apr 2, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

Adding to the milestone because this is needed for me to be confident in a solution for #23346. I'll finish this up tomorrow if you're busy :)

@viridia

viridia commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Can we also rename CoreScrollbarThumb to ScrollbarThumb?

The Core prefix is a hold-over from an earlier design, it was dropped from all the other widgets, but this one got missed because it was developed on a different branch.

@ickshonpe

Copy link
Copy Markdown
Contributor Author

Can we have this "after" PostLayout? #23346 This does not have ambiguity with text systems and ComputedNode

Just realised this shouldn't be in PostLayout, but after would be wrong too. Since this system does layout for thumb nodes, it should be in layout itself, just ordered after ui_layout_system I think. Same with the new popover system

@ickshonpe

Copy link
Copy Markdown
Contributor Author

Adding to the milestone because this is needed for me to be confident in a solution for #23346. I'll finish this up tomorrow if you're busy :)

Nope I got it, doesn't need much

…ollThumb`.

Added a `border: UiRect` field, which is used to set the thumb's `ComputedNode::border` in `update_scrollbar_thumb`.
@ickshonpe

Copy link
Copy Markdown
Contributor Author

Can we also rename CoreScrollbarThumb to ScrollbarThumb?

The Core prefix is a hold-over from an earlier design, it was dropped from all the other widgets, but this one got missed because it was developed on a different branch.

Done

Comment thread crates/bevy_ui_widgets/src/scrollbar.rs Outdated
Comment thread _release-content/migration-guides/CoreScrollThumb-is-now-ScrollThumb.md Outdated
Comment thread crates/bevy_ui_widgets/src/scrollbar.rs Outdated
Comment thread crates/bevy_ui_widgets/src/scrollbar.rs Outdated
Comment thread crates/bevy_ui_widgets/src/scrollbar.rs Outdated
thumb_node.border_radius = border_radius;
}

let resolve_border_val = |val: Val| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this actually need to be two diff lambdas for thumb_physical_size.x and thumb_physical_size.y?

@ickshonpe ickshonpe Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's iffy, but generally with percentage values both axes are resolved based on the horizontal width.

ickshonpe and others added 4 commits April 2, 2026 16:11
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
@alice-i-cecile alice-i-cecile 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-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Apr 2, 2026
@alice-i-cecile
alice-i-cecile enabled auto-merge April 2, 2026 15:15
@alice-i-cecile
alice-i-cecile disabled auto-merge April 2, 2026 15:21
@alice-i-cecile
alice-i-cecile enabled auto-merge April 2, 2026 15:30
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Apr 2, 2026
Merged via the queue into bevyengine:main with commit 33dbf93 Apr 2, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Apr 2, 2026
@micttyoid

Copy link
Copy Markdown
Contributor

According to what we did this time, for the future scheduler ordering, it's worth noting that system granularity (without system set) should be fine. We have rigorous ambiguity detection, so we don't suffer much if we need to update anything.

mate-h pushed a commit to mate-h/bevy that referenced this pull request Apr 14, 2026
bevyengine#23612)

# Objective

Update `ComputedNode` for scrollbar thumbs in `update_scrollbar_thumb`
to avoid delays and system ambiguities.

## Solution

* Removed `Node` from scrollbar thumb node entities. 
* Renamed `CoreScrollbarThumb` to `ScrollbarThumb`.
* `ScrollbarThumb` now requires all the UI components and gains `border`
and `border_radius` fields.
* `update_scrollbar_thumb` now updates `ScrollbarThumb` node's
`UiGlobalTransform` and `ComputedNode` in `PostLayout`.


## Testing

```
cargo run --example scrollbars
```

We need a better scrollbars example, added an issue bevyengine#23622.

---------

Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
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-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants