Skip to content

fix: text selection collapse on focus loss#24619

Open
zen-zap wants to merge 3 commits into
bevyengine:mainfrom
zen-zap:multiline_text
Open

fix: text selection collapse on focus loss#24619
zen-zap wants to merge 3 commits into
bevyengine:mainfrom
zen-zap:multiline_text

Conversation

@zen-zap

@zen-zap zen-zap commented Jun 13, 2026

Copy link
Copy Markdown

Objective

Solution

  • Added a new on_focus_lost_collapse_selection observer to the EditableTextInputPlugin.
  • When a FocusLost event is triggered, it queues an TextEdit::CollapseSelection action on the widget as well.

Testing

  • Tested it on the example mentioned in the issue (multiline_text_input).

Before:

image

After:

image

zen-zap added 2 commits June 14, 2026 01:10
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@kfc35 kfc35 added A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jun 13, 2026
@kfc35 kfc35 added D-Straightforward Simple bug fixes and API improvements, docs, test and examples C-Bug An unexpected or incorrect behavior labels Jun 13, 2026

@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.

The fix works, thanks! Just a comment to simplify this even further.

mut editable_text_query: Query<&mut EditableText>,
) {
if let Ok(mut editable_text) = editable_text_query.get_mut(trigger.entity) {
editable_text.queue_edit(TextEdit::CollapseSelection);

This comment was marked as resolved.

Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
@zen-zap zen-zap requested a review from kfc35 June 14, 2026 07:03
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.

multiline_text_input example: The numeric input's colors are wrong after navigation

2 participants