Skip to content

EditableText drag selection fix#24260

Open
ickshonpe wants to merge 2 commits into
bevyengine:mainfrom
ickshonpe:editabletext-drag-selection-fix
Open

EditableText drag selection fix#24260
ickshonpe wants to merge 2 commits into
bevyengine:mainfrom
ickshonpe:editabletext-drag-selection-fix

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 12, 2026

Objective

on_pointer_drag queues MoveToPoint as well as ExtendSelectionToPoint when dragging. So each time the mouse moves during a drag, the current selection is cleared and a new selection is created. As long as the local drag start position is constant this is seamless, but if you scroll the text input view, the start of the drag is now at a different position relative to the text layout, and the start of the selection range changes.

Solution

Don't queue the MoveToPoint edit.

Testing

Enter enough text to overflow the input's view, then select and drag so it scrolls.

cargo run --example multiline_text_input

…oint` when dragging. So each time the mouse moves during a drag, the current selection is cleared and a new selection is created. As long as the local drag start position is constant this is seamless, but if you scroll the text input view, the start of the drag is now at a different position relative to the text layout, and the start of the selection range changes.

Solution: Don't queue the `MoveToPoint` edit.
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 12, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI May 12, 2026
Copy link
Copy Markdown
Contributor

@chronicl chronicl left a comment

Choose a reason for hiding this comment

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

I changed it to this when implementing SelectAllOnFocus before I made the select all deferred for pointer click. Forgot to change it back after I made the select all deferred.

Looks good.

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

Labels

A-Text Rendering and layout for characters 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-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

2 participants