From 0bce6c6a46ec992cf979992772f7f5103c01cd78 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Aug 2021 13:02:18 +0530 Subject: [PATCH] added focus input on reply click --- src/app/organisms/channel/ChannelViewInput.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/organisms/channel/ChannelViewInput.jsx b/src/app/organisms/channel/ChannelViewInput.jsx index 3a771f5..6e5deb0 100644 --- a/src/app/organisms/channel/ChannelViewInput.jsx +++ b/src/app/organisms/channel/ChannelViewInput.jsx @@ -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();