[#2263] Change Focused state back to default in search box

In chat search box the focus state was remaining true
even though the user was clicking outside of it

Closes #2263
This commit is contained in:
Alexandra Betouni 2021-07-15 18:50:50 +03:00 committed by Iuri Matias
parent f66e64cc9c
commit 80943b3342
1 changed files with 16 additions and 5 deletions

View File

@ -23,6 +23,14 @@ Item {
Layout.fillHeight: true Layout.fillHeight: true
width: 304 width: 304
MouseArea {
anchors.fill: parent
onClicked: {
//steal focus from search field
addChat.forceActiveFocus();
}
}
StatusNavigationPanelHeadline { StatusNavigationPanelHeadline {
id: headline id: headline
anchors.top: parent.top anchors.top: parent.top
@ -39,6 +47,9 @@ Item {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
Keys.onEscapePressed: {
addChat.forceActiveFocus();
}
} }
AddChat { AddChat {
@ -70,19 +81,19 @@ Item {
ScrollView { ScrollView {
id: chatGroupsContainer id: chatGroupsContainer
width: parent.width
height: (contentHeight < (parent.height - contactRequests.height - Style.current.padding)) ? contentHeight : (parent.height - contactRequests.height - Style.current.padding)
anchors.top: contactRequests.bottom anchors.top: contactRequests.bottom
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
anchors.bottom: parent.bottom contentHeight: channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height + emptyViewAndSuggestions.anchors.topMargin
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
leftPadding: Style.current.halfPadding leftPadding: Style.current.halfPadding
rightPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
contentHeight: channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height + emptyViewAndSuggestions.anchors.topMargin
clip: true clip: true
Item { Item {
@ -106,8 +117,8 @@ Item {
chatNameFn: function (chatItem) { chatNameFn: function (chatItem) {
return chatItem.chatType !== Constants.chatTypePublic ? return chatItem.chatType !== Constants.chatTypePublic ?
Emoji.parse(Utils.removeStatusEns(Utils.filterXSS(chatItem.name))) : Emoji.parse(Utils.removeStatusEns(Utils.filterXSS(chatItem.name))) :
Utils.filterXSS(chatItem.name) Utils.filterXSS(chatItem.name)
} }
profileImageFn: function (id) { profileImageFn: function (id) {