Skip to content

Conversation

@PPakalns
Copy link
Contributor

Objective

Bevy ui widget scrollbar implementation didn't correctly handle scrollbar width inserted by taffy.

Solution

Correctly handle scrollbar width similarly as it is done in bevy engine scroll position calculation:

let max_possible_offset =
(content_size - layout_size + node.scrollbar_size).max(Vec2::ZERO);
let clamped_scroll_position = scroll_position.clamp(Vec2::ZERO, max_possible_offset);

Testing

  • In personal project added scrollareas with scrollbars that automatically attach to overflow: scroll elements and utilize space provided by taffy scrollbar-width.

@PPakalns PPakalns marked this pull request as ready for review November 14, 2025 10:44
@PPakalns PPakalns marked this pull request as draft November 14, 2025 13:45
@PPakalns

This comment was marked as resolved.

@PPakalns

This comment was marked as resolved.

@PPakalns

This comment was marked as resolved.

@PPakalns PPakalns marked this pull request as ready for review November 15, 2025 00:53
@PPakalns
Copy link
Contributor Author

Changes in action, utilizes scrollbar_size provided by taffy:

scroll-area-auto-attached.mov

@alice-i-cecile alice-i-cecile added this to the 0.18 milestone Nov 16, 2025
@alice-i-cecile
Copy link
Member

@rossleonardy, review? :)

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 16, 2025
@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-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 16, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Nov 16, 2025
Merged via the queue into bevyengine:main with commit d87d491 Nov 17, 2025
46 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-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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants