Skip to content

Commit

Permalink
fix(EnterSeedPhrase): focus last input field after paste
Browse files Browse the repository at this point in the history
Iterates: #17105
  • Loading branch information
caybro committed Feb 5, 2025
1 parent 32315aa commit 3fff463
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion storybook/qmlTests/tests/tst_EnterSeedPhrase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ Item {
ClipboardUtils.setText(expectedSeedPhrase.join(" "))

// Trigger the paste action
keyClick("v", Qt.ControlModifier)
keySequence(StandardKey.Paste)

// verify the last field has focus (https://github.com/status-im/status-desktop/issues/17105; issue 18)
const lastInputField = findChild(itemUnderTest, "enterSeedPhraseInputField12")
verify(!!lastInputField)
tryCompare(lastInputField, "activeFocus", true)

verify(isSeedPhraseValidCalled, "isSeedPhraseValid was not called")

Expand Down
6 changes: 6 additions & 0 deletions ui/imports/shared/panels/EnterSeedPhrase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ ColumnLayout {
const pos = item.mnemonicIndex
item.setWord(words[pos - 1])
}

// position on the last field
const lastItem = grid.itemAtIndex(grid.count - 1)
if (!!lastItem)
lastItem.textEdit.input.edit.forceActiveFocus()

d.checkMnemonicLength()
}, timeout)
return true
Expand Down

0 comments on commit 3fff463

Please sign in to comment.