Skip to content

Add automatic input focus cause#25059

Merged
alice-i-cecile merged 2 commits into
bevyengine:mainfrom
0xEgao:FocusAuto
Jul 20, 2026
Merged

Add automatic input focus cause#25059
alice-i-cecile merged 2 commits into
bevyengine:mainfrom
0xEgao:FocusAuto

Conversation

@0xEgao

@0xEgao 0xEgao commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Objective

Fixes #24958.

AutoFocus currently reports focus changes as FocusCause::Navigated, making automatic focus indistinguishable from keyboard or gamepad navigation.

Solution

  • Added FocusCause::Auto.
  • Emit FocusCause::Auto when an AutoFocus component assigns focus.
  • Preserve the existing text-input select-all behavior for automatic focus.

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice and simple, but needs a quick migration guide :)

@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jul 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Input Jul 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jul 18, 2026
@alice-i-cecile alice-i-cecile added this to the 0.20 milestone Jul 18, 2026
@alice-i-cecile alice-i-cecile added D-Straightforward Simple bug fixes and API improvements, docs, test and examples X-Uncontroversial This work is generally agreed upon labels Jul 18, 2026
@0xEgao

0xEgao commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Nice and simple, but needs a quick migration guide :)

Thanks !!
I have added the migration guide.
Happy to contribute :)

@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jul 18, 2026
@alice-i-cecile
alice-i-cecile requested a review from viridia July 18, 2026 17:54
@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 Jul 20, 2026
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Jul 20, 2026
Merged via the queue into bevyengine:main with commit 6ea281c Jul 20, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Jul 20, 2026
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Input Jul 20, 2026
viridia pushed a commit to viridia/bevy that referenced this pull request Jul 21, 2026
# Objective

Fixes bevyengine#24958.

`AutoFocus` currently reports focus changes as `FocusCause::Navigated`,
making automatic focus indistinguishable from keyboard or gamepad
navigation.

## Solution

- Added `FocusCause::Auto`.
- Emit `FocusCause::Auto` when an `AutoFocus` component assigns focus.
- Preserve the existing text-input select-all behavior for automatic
focus.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide 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
Status: Done

Development

Successfully merging this pull request may close these issues.

Add Auto variant to bevy::input_focus::FocusCause

3 participants