emojier: go back to search field on Arrow Up

Arrow Down from the search field goes to the main gridView, but Arrow
Up from there doesn't go back. Our previous implementation using
KeyNavigation broke during refactoring, and was half-replaced.

Instead, fix the KeyNavigation, and make the handover pattern a bit
more obvious with a comment (similar to how we have them in a couple
of other places)
This commit is contained in:
Christoph Wolk 2026-08-20 19:58:37 +02:00
parent 4e40c3e179
commit 0fe4c7170d

View file

@ -75,13 +75,13 @@ Kirigami.ScrollablePage {
Keys.onReturnPressed: event => emojiView.currentItem?.Keys.returnPressed(event)
Keys.onDownPressed: event => {
emojiView.currentIndex = Math.max(emojiView.currentIndex, 0)
event.accepted = false
emojiView.forceActiveFocus(Qt.TabFocusReason)
event.accepted = false // pass to KeyNavigation
}
KeyNavigation.down: emojiView
Binding {
view.Keys.forwardTo: [searchField]
view.KeyNavigation.up: searchField.KeyNavigation.down // explicitly set as this and clear button point there
emojiView.KeyNavigation.up: searchField
}
Connections {
target: view
@ -383,7 +383,7 @@ Kirigami.ScrollablePage {
if (currentIndex < columnsToHave - 1) {
currentIndex = -1
}
event.accepted = false
event.accepted = false // pass to ListView or KeyNavigation.up, bound from header
}
delegate: emojiDelegateComponent