I have following in the footer of a SilicaListview. When pushing the send button, keyboard goes very shortly away, and then comes back and gives focus again to the Textarea.
Is there a possibility to avoid that focus shortly goes away, and that keyboard just stays open and focus is kept to the textarea?
footer : Column {
id: replyColumn
width: parent.width
Item {
id: inputRow
width: parent.width
height: replyField.height
TextArea {
id: replyField
width: parent.width - attachButton.width - sendButton.width - 2 * Theme.paddingSmall - Theme.horizontalPageMargin
//: Label for message
//% "Message"
label: qsTrId("message-la-message")
//: Placeholder for send message
//% "Send message"
placeholderText: qsTrId("message-ph-sendmessage")
hideLabelOnEmptyField: false
backgroundStyle: TextEditor.FilledBackground
horizontalAlignment: TextInput.AlignLeft
// height: Math.min(implicitHeight, Theme.itemSizeExtraLarge * 2)
Component.onCompleted: {
page.replyFieldRef = replyField
replyField.text = Drafts.loadDraft(roomId)
}
}
Row {
id: buttonRow
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: Theme.paddingSmall
Button {
id: attachButton
width: Theme.iconSizeMedium + 2 * Theme.paddingSmall
height: width
icon.source: "image://theme/icon-m-attach"
onClicked:
pageStack.animatorPush(Qt.resolvedUrl("ImageSelectPage.qml"))
}
Button {
id: sendButton
width: Theme.iconSizeMedium + 2 * Theme.paddingSmall
height: width
icon.source: "image://theme/icon-m-send"
onClicked: {
if (replyField.text !== "") {
//: Notification when sending message
//% "Sending message"
Notices.show(qsTrId("message-no-messagesending"), Notice.Short, Notice.Center)
console.log("fake send, no backend call")
matrixSession.sendTextMessage(roomId, replyField.text)
replyField.forceActiveFocus()
}
}
}
}
}
}