From dda9eaca2a05ef22e593839ad5c15c78df631e15 Mon Sep 17 00:00:00 2001 From: Jeet Desai <52026385+jeet1desai@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:07:32 +0530 Subject: [PATCH] Place cursor at end when entering cell (#3743) #3723 #3724 place cursor at end when entering cell --- .../ui/field/input/components/TextAreaInput.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/ui/field/input/components/TextAreaInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/TextAreaInput.tsx index dd14285bb..7a354a138 100644 --- a/packages/twenty-front/src/modules/ui/field/input/components/TextAreaInput.tsx +++ b/packages/twenty-front/src/modules/ui/field/input/components/TextAreaInput.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, useRef, useState } from 'react'; +import { ChangeEvent, useEffect, useRef, useState } from 'react'; import TextareaAutosize from 'react-textarea-autosize'; import styled from '@emotion/styled'; @@ -54,6 +54,15 @@ export const TextAreaInput = ({ const wrapperRef = useRef(null); + useEffect(() => { + if (wrapperRef.current) { + wrapperRef.current.setSelectionRange( + wrapperRef.current.value.length, + wrapperRef.current.value.length, + ); + } + }, []); + useRegisterInputEvents({ inputRef: wrapperRef, inputValue: internalText,