From e8eb8adf5f7375cf0b675aba473ac921ba438d03 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 19 Nov 2024 13:43:59 +0800 Subject: [PATCH] Fix keyboard tab behaviour when focus reaches unified search bar Do not activate search if the focus reason is tab as otherwise the user will never be able to access elements that depend on search being inactive via the keyboard Signed-off-by: Claudio Cambra --- src/gui/tray/MainWindow.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/tray/MainWindow.qml b/src/gui/tray/MainWindow.qml index 5d9da51b81fc8..df558f0d17423 100644 --- a/src/gui/tray/MainWindow.qml +++ b/src/gui/tray/MainWindow.qml @@ -229,7 +229,7 @@ ApplicationWindow { || unifiedSearchResultNothingFound.visible || unifiedSearchResultsErrorLabel.visible || unifiedSearchResultsListView.visible - || trayWindowUnifiedSearchInputContainer.activeFocus + || trayWindowUnifiedSearchInputContainer.activateSearchFocus anchors.fill: parent anchors.margins: Style.trayWindowBorderWidth @@ -255,6 +255,8 @@ ApplicationWindow { UnifiedSearchInputContainer { id: trayWindowUnifiedSearchInputContainer + property bool activateSearchFocus: activeFocus + anchors.top: trayWindowHeader.bottom anchors.left: trayWindowMainItem.left anchors.right: trayWindowMainItem.right @@ -267,6 +269,7 @@ ApplicationWindow { isSearchInProgress: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress onTextEdited: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = trayWindowUnifiedSearchInputContainer.text } onClearText: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = "" } + onActiveFocusChanged: activateSearchFocus = activeFocus && focusReason !== Qt.TabFocusReason && focusReason !== Qt.BacktabFocusReason } Rectangle {