don't automatically focus message input on mobile
This commit is contained in:
parent
ae7875955a
commit
f8af8a78fc
1 changed files with 9 additions and 3 deletions
|
@ -97,14 +97,20 @@
|
|||
|
||||
|
||||
// Focus the text area when the component first loads, or when the user selects another channel
|
||||
const focusTextarea = () => messageTextarea && messageTextarea.focus();
|
||||
const focusTextarea = () => {
|
||||
if (messageTextarea && getItem("ui:useragent:formFactor") !== "touch") {
|
||||
messageTextarea.focus();
|
||||
}
|
||||
};
|
||||
onMount(focusTextarea);
|
||||
unsubscribers.push(selectedChannel.subscribe(focusTextarea));
|
||||
unsubscribers.push(selectedChannel.watch(focusTextarea));
|
||||
|
||||
// Handle the setMessageInput event
|
||||
unsubscribers.push(setMessageInputEvent.watch((value) => {
|
||||
messageInput = value;
|
||||
focusTextarea();
|
||||
if (messageTextarea) {
|
||||
messageTextarea.focus();
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue