From e40f2bfee9d879b9b725d1dece65e0afcfe2efce Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 29 Aug 2026 22:31:22 +0200 Subject: [PATCH] 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) --- ui/dr-ui/ui/identity.slint | 11 ++++++++++- ui/dr-ui/ui/widgets.slint | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ui/dr-ui/ui/identity.slint b/ui/dr-ui/ui/identity.slint index 1db0d13..c8d03a2 100644 --- a/ui/dr-ui/ui/identity.slint +++ b/ui/dr-ui/ui/identity.slint @@ -433,7 +433,16 @@ export component IdentityScreen inherits Rectangle { : 0px; visible: root.selected-person >= 0; edited(t) => { root.name-edited(t); } - accepted(t) => { root.rename(t); } + // Enter *finishes* naming this person, so the field lets + // the keyboard go with it. Without this the entry keeps + // focus after the name is committed, and on a tablet the + // on-screen keyboard stays up over the faces the user + // pressed Enter to get back to — the name looks accepted + // and the screen looks stuck. + accepted(t) => { + root.rename(t); + name-field.release-focus(); + } } if root.selected-person < 0: Text { text: "Select a person"; diff --git a/ui/dr-ui/ui/widgets.slint b/ui/dr-ui/ui/widgets.slint index e51156e..18c32a6 100644 --- a/ui/dr-ui/ui/widgets.slint +++ b/ui/dr-ui/ui/widgets.slint @@ -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;