Fix keyboard tab behaviour when focus reaches unified search bar
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 19 Nov 2024 05:43:59 +0000 (13:43 +0800)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 21 Nov 2024 09:13:00 +0000 (10:13 +0100)
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 <claudio.cambra@nextcloud.com>
src/gui/tray/MainWindow.qml

index 5d9da51b81fc8bbfb568476edcdfdb8d024aa121..df558f0d174234ce223778ca2258d780001e5a97 100644 (file)
@@ -229,7 +229,7 @@ ApplicationWindow {
                                              || unifiedSearchResultNothingFound.visible\r
                                              || unifiedSearchResultsErrorLabel.visible\r
                                              || unifiedSearchResultsListView.visible\r
-                                             || trayWindowUnifiedSearchInputContainer.activeFocus\r
+                                             || trayWindowUnifiedSearchInputContainer.activateSearchFocus\r
 \r
         anchors.fill: parent\r
         anchors.margins: Style.trayWindowBorderWidth\r
@@ -255,6 +255,8 @@ ApplicationWindow {
         UnifiedSearchInputContainer {\r
             id: trayWindowUnifiedSearchInputContainer\r
 \r
+            property bool activateSearchFocus: activeFocus\r
+\r
             anchors.top: trayWindowHeader.bottom\r
             anchors.left: trayWindowMainItem.left\r
             anchors.right: trayWindowMainItem.right\r
@@ -267,6 +269,7 @@ ApplicationWindow {
             isSearchInProgress: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress\r
             onTextEdited: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = trayWindowUnifiedSearchInputContainer.text }\r
             onClearText: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = "" }\r
+            onActiveFocusChanged: activateSearchFocus = activeFocus && focusReason !== Qt.TabFocusReason && focusReason !== Qt.BacktabFocusReason\r
         }\r
 \r
         Rectangle {\r