Fix focus behavior when pressing Tab with no focus (#1861)

This commit is contained in:
Matt Campbell 2022-07-29 03:42:09 -05:00 committed by GitHub
parent 09d636b089
commit b3ab31953e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -31,6 +31,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui-w
* Fixed `Plot` auto-bounds bug ([#1599](https://github.com/emilk/egui/pull/1599)). * Fixed `Plot` auto-bounds bug ([#1599](https://github.com/emilk/egui/pull/1599)).
* Fixed dead-lock when alt-tabbing while also showing a tooltip ([#1618](https://github.com/emilk/egui/pull/1618)). * Fixed dead-lock when alt-tabbing while also showing a tooltip ([#1618](https://github.com/emilk/egui/pull/1618)).
* Fixed `ScrollArea` scrolling when editing an unrelated `TextEdit` ([#1779](https://github.com/emilk/egui/pull/1779)). * Fixed `ScrollArea` scrolling when editing an unrelated `TextEdit` ([#1779](https://github.com/emilk/egui/pull/1779)).
* Fixed focus behavior when pressing Tab in a UI with no focused widget ([#1861](https://github.com/emilk/egui/pull/1861)).
## 0.18.1 - 2022-05-01 ## 0.18.1 - 2022-05-01

View file

@ -298,6 +298,7 @@ impl Focus {
} else if self.pressed_tab && self.id == None && !self.give_to_next { } else if self.pressed_tab && self.id == None && !self.give_to_next {
// nothing has focus and the user pressed tab - give focus to the first widgets that wants it: // nothing has focus and the user pressed tab - give focus to the first widgets that wants it:
self.id = Some(id); self.id = Some(id);
self.pressed_tab = false;
} }
self.last_interested = Some(id); self.last_interested = Some(id);