added focus input on reply click
authorunknown <ajbura@gmail.com>
Wed, 25 Aug 2021 07:32:18 +0000 (13:02 +0530)
committerunknown <ajbura@gmail.com>
Wed, 25 Aug 2021 07:32:18 +0000 (13:02 +0530)
src/app/organisms/channel/ChannelViewInput.jsx

index 3a771f51b17e52f3b836d9eeb1fc0878600c76d6..6e5deb0433c353521032e04ba484f0a1f8ab5476 100644 (file)
@@ -133,9 +133,14 @@ function ChannelViewInput({
     deactivateCmd();
   }
 
+  function focusInput() {
+    textAreaRef.current.focus();
+  }
+
   function setUpReply(userId, eventId, content) {
     setReplyTo({ userId, eventId, content });
     roomsInput.setReplyTo(roomId, { userId, eventId, content });
+    focusInput();
   }
 
   useEffect(() => {
@@ -147,7 +152,7 @@ function ChannelViewInput({
     viewEvent.on('reply_to', setUpReply);
     if (textAreaRef?.current !== null) {
       isTyping = false;
-      textAreaRef.current.focus();
+      focusInput();
       textAreaRef.current.value = roomsInput.getMessage(roomId);
       setAttachment(roomsInput.getAttachment(roomId));
       setReplyTo(roomsInput.getReplyTo(roomId));
@@ -192,7 +197,7 @@ function ChannelViewInput({
     await roomsInput.sendInput(roomId);
     textAreaRef.current.disabled = false;
     textAreaRef.current.style.cursor = 'unset';
-    textAreaRef.current.focus();
+    focusInput();
 
     textAreaRef.current.value = roomsInput.getMessage(roomId);
     timelineScroll.reachBottom();