aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/MessageInput.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components/MessageInput.js')
-rw-r--r--vnext/src/components/MessageInput.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/vnext/src/components/MessageInput.js b/vnext/src/components/MessageInput.js
index bd80d1ea..32c32d8d 100644
--- a/vnext/src/components/MessageInput.js
+++ b/vnext/src/components/MessageInput.js
@@ -14,11 +14,14 @@ export default function MessageInput({ data, rows, children, onSend }) {
let textareaRef = useRef();
let fileinput = useRef();
- useEffect(() => {
+ let updateFocus = () => {
const isDesktop = window.matchMedia('(min-width: 62.5rem)');
if (isDesktop.matches) {
textareaRef.current.focus();
}
+ };
+ useEffect(() => {
+ updateFocus();
}, []);
let handleCtrlEnter = (event) => {
@@ -53,6 +56,7 @@ export default function MessageInput({ data, rows, children, onSend }) {
formState.values.body = '';
textareaRef.current.value = '';
textareaRef.current.style.height = '';
+ updateFocus();
};
return (
<form className="msg-comment-target" style={{ padding: '12px' }} onSubmit={onSubmit}>