Skip to content

Add vertical scrollbar to multiline_text_input example#25066

Open
Supremesv715 wants to merge 3 commits into
bevyengine:mainfrom
Supremesv715:some
Open

Add vertical scrollbar to multiline_text_input example#25066
Supremesv715 wants to merge 3 commits into
bevyengine:mainfrom
Supremesv715:some

Conversation

@Supremesv715

Copy link
Copy Markdown
Contributor

Objective

Fixes #24646
The multiline_text_input example's scrollable EditableText input has no scrollbar, making it unclear how much content is above/below the visible area.

Solution

Added EditableText::content_size, exposing the full text layout size (previously a private local in update_editable_text_layout) so external code can compute how much of the content is visible.
Built a self-contained track + thumb scrollbar in the example, synced to EditableText::viewport/content_size:
Thumb size/position reflects the visible fraction and scroll offset.
Thumb is draggable and writes back to viewport.offset.y.
Hidden when the full layout already fits in the viewport.
No TabIndex, so it's unreachable via Tab navigation and can't take input focus, per the issue's requirements.
The existing bevy_ui_widgets::Scrollbar widget wasn't reusable here since it's hard-wired to ScrollPosition, which EditableText doesn't use.

Testing

cargo build -p bevy_text -p bevy_ui — passes.
Manually ran the example: typed past the visible line count to confirm the thumb appears/resizes, dragged the thumb to confirm it scrolls the input, deleted text back down to confirm the thumb hides, and tabbed through the UI to confirm the scrollbar is never focused.


@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets C-Testing A change that impacts how we test Bevy or how users test their apps 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 Jul 20, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jul 20, 2026
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-Examples An addition or correction to our examples C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

multiline_text_input example: Add a vertical scrollbar

2 participants