diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index b4a1a440..c8842b93 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -86,11 +86,16 @@ const ReplyModal = ({ closeModal, parentCid, scrollY }: ReplyModalProps) => { if (ref) { textRef.current = ref; !isMobile && ref.focus(); - const len = ref.value.length; - ref.setSelectionRange(len, len); } }; + useEffect(() => { + if (textRef.current) { + const len = textRef.current.value.length; + textRef.current.setSelectionRange(len, len); + } + }, []); + const contentPrefix = `c/${parentCid && Plebbit.getShortCid(parentCid)}\n`; const handleContentInput = (e: React.ChangeEvent) => {