lockscreen: Forward keyboard key immediately to password bar

Currently, only the second key press gets forwarded to the password bar.
Ensure that the first key is also forwarded correctly.
This commit is contained in:
Devin Lin 2024-10-18 22:19:27 -07:00
parent eecbba3f03
commit b6f2740ff4

View file

@ -35,11 +35,13 @@ Item {
}
// Listen for keyboard events, and focus on input area
Keys.onPressed: {
Keys.onPressed: (event) => {
if (flickableLoader.item) {
root.lockScreenState.isKeyboardMode = true;
flickableLoader.item.goToOpenPosition();
passwordBar.textField.forceActiveFocus();
passwordBar.keyPress(event.text);
}
}
@ -176,7 +178,7 @@ Item {
// Clear entered password after closing keypad
onOpenFactorChanged: {
if (flickable.openFactor < 0.1) {
if (flickable.openFactor < 0.1 && !flickable.movingUp) {
root.passwordBar.clear();
}
}