-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DragValue: when keyboard editing, only update the value on focus lost #2688
DragValue: when keyboard editing, only update the value on focus lost #2688
Conversation
Actually, it is very convenient to be able to move keyboard focus to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the addition of if response.lost_focus()
- it is really a much better behavior - but please revert the change where you can no longer change the value with up/down
if let Some(parsed_value) = parsed_value { | ||
let parsed_value = clamp_to_range(parsed_value, clamp_range.clone()); | ||
set(&mut get_set_value, parsed_value); | ||
if response.lost_focus() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you also added a comment justifying why this check should be done. The fact that it was absent before allows us to conclude that it is not self evident. Description of the reasons why this check was added and what it affects will make it easier to resolve problems if this change leads to them.
A good tone will also leave a link to the GitHub Issue, where you can get more information.
Closes #2687
Since the underlying
TextEdit
issingleline
, pressing enter also results in lost focus.I demonstrate two instances of this below. I press enter after the first edit, then click away after the second.
I also shuffled some of the accesskit stuff. The up and down arrow keys probably shouldn't change the value during keyboard editing either. That little change allowed me to consolidate the accesskit code a bit better. I'm not sure how to test it.
As far as testing goes,
./sh/check.sh
failed in my environment (WSL 2) for some winit / platform reason. Clippy has no complaints about my changes.