-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard navigation: focus change loses new value in DragValue #2877
Comments
relevant: #2880 |
The code that decides whether the value should be updated is this: egui/crates/egui/src/widgets/drag_value.rs Lines 494 to 500 in d77c446
The code is conditional on the egui/crates/egui/src/widgets/drag_value.rs Lines 389 to 400 in d77c446
It seems that the problem is that on the frame where the TextEdit would lose focus after pressing tab, egui/crates/egui/src/widgets/text_edit/builder.rs Lines 967 to 981 in d77c446
Given that, I wonder what would be the best way to fix it. Maybe we could change the logic for |
In the Widget Gallery of Egui Demo, focus the DragValue and type in a new number. Tab or Shift+Tab moves the focus to the next widget, but the new value is lost. The value is kept only when Enter is pressed, but then the focus is lost.
egui.demo.app.2023-04-06.09-19-40.mp4
This somewhat defeats keyboard navigation with DragValues because one can either navigate or change values, but not both.
Expected behavior
DragValue should keep the value entered when Tab is pressed.
Tested on the web demo at egui.rs and eframe on Windows using egui version 0.21.3-28-geb0812a9 (2023-03-31).
There seems to be a related issue: the internal state of the TextEdit/DragValue (text cursor position, selection) seems to be remembered when navigating away with Tab, and is reset only when focusing the widget with the mouse (which selects the whole number). Perhaps focusing the DragValue with Tab should work like focusing with the mouse.
The text was updated successfully, but these errors were encountered: