diff --git a/src/gui/Base/HPageHeader.qml b/src/gui/Base/HPageHeader.qml index a3b66f62..36041609 100644 --- a/src/gui/Base/HPageHeader.qml +++ b/src/gui/Base/HPageHeader.qml @@ -26,7 +26,7 @@ Rectangle { icon.name: "go-back-to-main-pane" toolTip.text: qsTr("Go back to main pane") - onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() + onClicked: mainUI.mainPane.toggleFocus() Layout.preferredWidth: theme.baseElementsHeight Layout.fillHeight: true diff --git a/src/gui/MainPane/BottomBar.qml b/src/gui/MainPane/BottomBar.qml index b093b0cc..c7bbc053 100644 --- a/src/gui/MainPane/BottomBar.qml +++ b/src/gui/MainPane/BottomBar.qml @@ -16,17 +16,6 @@ Rectangle { readonly property alias filterField: filterField - function toggleFocus() { - if (filterField.activeFocus) { - pageLoader.takeFocus() - return - } - - mainPane.open() - filterField.forceActiveFocus() - } - - HRowLayout { anchors.fill: parent @@ -67,7 +56,7 @@ Rectangle { } Keys.onEscapePressed: { - mainUI.pageLoader.forceActiveFocus() + mainPane.toggleFocus() if (window.settings.clearRoomFilterOnEscape) text = "" } @@ -81,7 +70,7 @@ Rectangle { HShortcut { sequences: window.settings.keys.toggleFocusMainPane - onActivated: toggleFocus() + onActivated: mainPane.toggleFocus() } } } diff --git a/src/gui/MainPane/MainPane.qml b/src/gui/MainPane/MainPane.qml index 5d86ddb0..70d2f0a9 100644 --- a/src/gui/MainPane/MainPane.qml +++ b/src/gui/MainPane/MainPane.qml @@ -15,6 +15,17 @@ HDrawer { readonly property alias bottomBar: bottomBar + function toggleFocus() { + if (bottomBar.filterField.activeFocus) { + pageLoader.takeFocus() + return + } + + mainPane.open() + bottomBar.filterField.forceActiveFocus() + } + + Behavior on opacity { HNumberAnimation {} } Binding on visible { diff --git a/src/gui/Pages/Chat/RoomHeader.qml b/src/gui/Pages/Chat/RoomHeader.qml index 8df4140c..ec4a7a82 100644 --- a/src/gui/Pages/Chat/RoomHeader.qml +++ b/src/gui/Pages/Chat/RoomHeader.qml @@ -34,7 +34,7 @@ Rectangle { icon.name: "go-back-to-main-pane" toolTip.text: qsTr("Go back to main pane") - onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() + onClicked: mainUI.mainPane.toggleFocus() Layout.preferredWidth: showPaneButtons ? avatar.width : 0 Layout.fillHeight: true diff --git a/src/gui/Pages/Chat/RoomPane/RoomPane.qml b/src/gui/Pages/Chat/RoomPane/RoomPane.qml index f9629bc3..7c16fefe 100644 --- a/src/gui/Pages/Chat/RoomPane/RoomPane.qml +++ b/src/gui/Pages/Chat/RoomPane/RoomPane.qml @@ -80,6 +80,6 @@ MultiviewPane { HShortcut { sequences: window.settings.keys.toggleFocusRoomPane - onActivated: toggleFocus() + onActivated: roomPane.toggleFocus() } }