diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml index daa4b3c..a7c67b9 100644 --- a/modules/lock/LockSurface.qml +++ b/modules/lock/LockSurface.qml @@ -139,14 +139,26 @@ WlSessionLockSurface { } } - // Keyboard input - focus lives on an Item since WlSessionLockSurface is a window + // Keyboard input - focus lives on an Item since WlSessionLockSurface is a window. + // Aggressively reclaim focus: Component.onCompleted may fire before the surface + // is configured, and other items can steal activeFocus during layout. Item { + id: _keyInput anchors.fill: parent focus: true Keys.onPressed: event => { if (!root._unlocking) root.auth.handleKey(event); } + onActiveFocusChanged: { + if (!activeFocus) + forceActiveFocus(); + } + } + + onVisibleChanged: { + if (visible) + _keyInput.forceActiveFocus(); } // Unlock animation