fix focus behavior on new page/popup

This commit is contained in:
Cyril Anisimov 2024-12-09 01:35:10 +01:00
parent 3cc70790bd
commit ea39447708
2 changed files with 7 additions and 8 deletions

View file

@ -10,7 +10,7 @@ Item {
property StackView stackView: StackView.view
onVisibleChanged: {
if (visible && !GC.isMobile()) {
if (visible) {
timer.start()
}
}
@ -20,10 +20,11 @@ Item {
id: timer
interval: 200 // Milliseconds
onTriggered: {
console.debug(">>> PageType timer triggered")
FocusController.resetRootObject()
FocusController.setFocusOnDefaultItem()
}
repeat: false // Stop the timer after one trigger
running: !GC.isMobile() // Start the timer
running: true // Start the timer
}
}

View file

@ -45,15 +45,13 @@ Popup {
Timer {
id: timer
interval: 400 // Milliseconds
interval: 200 // Milliseconds
onTriggered: {
if (!GC.isMobile()) {
FocusController.setFocusItem(closeButton)
FocusController.pushRootObject(root)
}
FocusController.pushRootObject(root)
FocusController.setFocusItem(closeButton)
}
repeat: false // Stop the timer after one trigger
running: !GC.isMobile() // Start the timer
running: true // Start the timer
}
contentItem: Item {