diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-20 10:16:49 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-20 10:16:49 +0200 |
| commit | 3ce95cbbbf40999974f3ba655f099a2e49f5d6c6 (patch) | |
| tree | 664b9cd38898ea77bff8d4601e9df7f39c279d24 /theme/components | |
| parent | 1c6e9d6c3c8281e79e212496b8e874708edd91f5 (diff) | |
| download | sddm-theme-udt-3ce95cbbbf40999974f3ba655f099a2e49f5d6c6.tar.gz sddm-theme-udt-3ce95cbbbf40999974f3ba655f099a2e49f5d6c6.zip | |
fix: keep keyboard focus on the credential field
Bind each field's focus to the stage so the greeter's window
activation has a focus target and focus follows the stage switch.
The startup focusStage() ran while the view was still hidden, where
forceActiveFocus() is dropped, so re-ask once from a short one-shot
timer after the view is on screen.
Verified in sddm-greeter --test-mode: username focused at start,
password focused after advancing.
Diffstat (limited to 'theme/components')
| -rw-r--r-- | theme/components/Credentials.qml | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/theme/components/Credentials.qml b/theme/components/Credentials.qml index f565474..f6fa0bf 100644 --- a/theme/components/Credentials.qml +++ b/theme/components/Credentials.qml @@ -45,7 +45,16 @@ Item { } onStageChanged: focusStage() - Component.onCompleted: focusStage() + + // The greeter creates the QML before it shows the view, so a focus call at + // component completion lands while the window is still hidden and is + // dropped. Ask again once the view is on screen; from then on the field's + // focus binding follows the stage. + Timer { + interval: 200 + running: true + onTriggered: creds.focusStage() + } // Back chevron, password stage only. The width animates so the slot grows // and shrinks with it. @@ -147,6 +156,7 @@ Item { height: slot.height text: userModel.lastUser !== undefined ? userModel.lastUser : "" placeholderText: "Username" + focus: !creds.passwordStage activeFocusOnTab: !creds.passwordStage font.family: "Noto Sans" color: config.stringValue("text") @@ -177,6 +187,7 @@ Item { height: slot.height echoMode: TextInput.Password placeholderText: "Password" + focus: creds.passwordStage activeFocusOnTab: creds.passwordStage font.family: "Noto Sans" color: config.stringValue("text") |
