Let go of the keyboard when a name is finished
Pressing Enter on a person's name committed it and then kept the field focused, so on a tablet the on-screen keyboard stayed up over the faces the user had pressed Enter to get back to. The name looked accepted and the screen looked stuck. `Field` grows `release-focus()`, the other half of the `take-focus()` it already had, and the Identity screen calls it from `accepted`. A function rather than a property for the reason the existing one gives: focus is an event, and bound to a property it would fight anything else that took it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -633,6 +633,19 @@ export component Field inherits Rectangle {
|
||||
input.select-all();
|
||||
}
|
||||
|
||||
/// Give the keyboard back.
|
||||
///
|
||||
/// The other half of `take-focus`, and the one a field that *submits*
|
||||
/// needs: pressing Enter on a name has finished with the name, but Slint
|
||||
/// leaves the entry focused, so on a tablet the on-screen keyboard stays
|
||||
/// up covering the very thing the user just named. Nothing else on those
|
||||
/// screens takes focus on its own, so the field has to let go itself.
|
||||
///
|
||||
/// A function and not a property, for the reason `take-focus` gives.
|
||||
public function release-focus() {
|
||||
input.clear-focus();
|
||||
}
|
||||
|
||||
height: Theme.touch-target;
|
||||
border-radius: Theme.radius;
|
||||
border-width: 1px;
|
||||
|
||||
Reference in New Issue
Block a user