fix(@desktop/profile): Enter key doesnt activate button

Added code so that in the backup seed phrase modal all actions can be performed with the enter key.
Also added logic for default focus on the confirm button in the ConfirmationDialog.

fixes#2359
This commit is contained in:
Khushboo Mehta 2021-08-18 18:11:17 +02:00 committed by Iuri Matias
parent 8676533339
commit d4de0c25a4
2 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,8 @@ ModalPopup {
property int seedWord2Idx: -1;
property string validationError: ""
focus: visible
onOpened: {
seedWord1Idx = -1;
seedWord2Idx = -1;
@ -143,9 +145,19 @@ ModalPopup {
}
Item {
id: textInput
visible: seedWord1Idx > -1 || seedWord2Idx > -1
anchors.left: parent.left
anchors.right: parent.right
focus: visible
onActiveFocusChanged: {
if (activeFocus)
txtFieldWord.forceActiveFocus(Qt.MouseFocusReason)
}
Keys.onReturnPressed: function(event) {
confirmButton.clicked()
}
StyledText {
id: txtChk
//% "Check your seed phrase"
@ -223,6 +235,7 @@ ModalPopup {
footer: StatusButton {
id: confirmButton
text: showWarning ?
//% "Okay, continue"
qsTrId("ok-continue") :
@ -231,6 +244,10 @@ ModalPopup {
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
anchors.bottom: parent.bottom
focus: !textInput.visible
Keys.onReturnPressed: function(event) {
confirmButton.clicked()
}
onClicked: {
if(showWarning){
showWarning = false;

View File

@ -18,6 +18,7 @@ ModalPopup {
width: 400
//% "Confirm your action"
title: qsTrId("confirm-your-action")
focus: visible
//% "Confirm"
property string confirmButtonLabel: qsTrId("close-app-button")
@ -71,6 +72,10 @@ ModalPopup {
anchors.rightMargin: cancelButton.visible ? Style.current.smallPadding : 0
text: confirmationDialog.confirmButtonLabel
anchors.bottom: parent.bottom
focus: true
Keys.onReturnPressed: function(event) {
confirmButton.clicked()
}
onClicked: {
if (executeConfirm && typeof executeConfirm === "function") {
executeConfirm()