Skip to content

Commit

Permalink
Fix keyboard tab behaviour when focus reaches unified search bar
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Nov 21, 2024
1 parent 02372d9 commit e8eb8ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/tray/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ ApplicationWindow {
|| unifiedSearchResultNothingFound.visible
|| unifiedSearchResultsErrorLabel.visible
|| unifiedSearchResultsListView.visible
|| trayWindowUnifiedSearchInputContainer.activeFocus
|| trayWindowUnifiedSearchInputContainer.activateSearchFocus

anchors.fill: parent
anchors.margins: Style.trayWindowBorderWidth
Expand All @@ -255,6 +255,8 @@ ApplicationWindow {
UnifiedSearchInputContainer {
id: trayWindowUnifiedSearchInputContainer

property bool activateSearchFocus: activeFocus

anchors.top: trayWindowHeader.bottom
anchors.left: trayWindowMainItem.left
anchors.right: trayWindowMainItem.right
Expand All @@ -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 {
Expand Down

0 comments on commit e8eb8ad

Please sign in to comment.