Fix keyboard focus during setup while tip is up

This commit is contained in:
Zach Fox 2017-09-28 13:12:42 -07:00
parent 751dca0761
commit 3742ccbdd3
2 changed files with 13 additions and 4 deletions

View file

@ -26,6 +26,7 @@ Item {
id: root; id: root;
property bool isChangingPassphrase: false; property bool isChangingPassphrase: false;
property bool isShowingTip: false; property bool isShowingTip: false;
property bool shouldImmediatelyFocus: true;
// This object is always used in a popup. // This object is always used in a popup.
// This MouseArea is used to prevent a user from being // This MouseArea is used to prevent a user from being
@ -53,10 +54,8 @@ Item {
// TODO: Fix this unlikely bug // TODO: Fix this unlikely bug
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
if (root.isChangingPassphrase) { if (root.shouldImmediatelyFocus) {
currentPassphraseField.focus = true; focusFirstTextField();
} else {
passphraseField.focus = true;
} }
sendMessageToLightbox({method: 'disableHmdPreview'}); sendMessageToLightbox({method: 'disableHmdPreview'});
} else { } else {
@ -320,5 +319,13 @@ Item {
setErrorText(""); setErrorText("");
} }
function focusFirstTextField() {
if (root.isChangingPassphrase) {
currentPassphraseField.focus = true;
} else {
passphraseField.focus = true;
}
}
signal sendMessageToLightbox(var msg); signal sendMessageToLightbox(var msg);
} }

View file

@ -422,6 +422,7 @@ Item {
onClicked: { onClicked: {
root.hasShownSecurityImageTip = true; root.hasShownSecurityImageTip = true;
securityImageTip.visible = false; securityImageTip.visible = false;
passphraseSelection.focusFirstTextField();
} }
} }
} }
@ -466,6 +467,7 @@ Item {
PassphraseSelection { PassphraseSelection {
id: passphraseSelection; id: passphraseSelection;
shouldImmediatelyFocus: root.hasShownSecurityImageTip;
isShowingTip: securityImageTip.visible; isShowingTip: securityImageTip.visible;
anchors.top: passphraseTitleHelper.bottom; anchors.top: passphraseTitleHelper.bottom;
anchors.topMargin: 30; anchors.topMargin: 30;