From ad831f5535e08dffd7492043a8b3c8b580c5cf30 Mon Sep 17 00:00:00 2001 From: ajeet <109718740+ajeetcode@users.noreply.github.com> Date: Sat, 25 Nov 2023 16:40:57 +0530 Subject: [PATCH] fixes wrong position of cursor --- client/modules/IDE/components/EditableInput.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/components/EditableInput.jsx b/client/modules/IDE/components/EditableInput.jsx index 9f951d1de4..a323903e2b 100644 --- a/client/modules/IDE/components/EditableInput.jsx +++ b/client/modules/IDE/components/EditableInput.jsx @@ -28,7 +28,12 @@ function EditableInput({ const { t } = useTranslation(); React.useEffect(() => { if (isEditing) { - inputRef.current?.focus(); + const inputElement = inputRef.current; + inputElement.setSelectionRange( + inputElement.value.length, + inputElement.value.length + ); + inputElement.focus(); } }, [isEditing]); React.useEffect(() => {