From 855c65bc87c118c0d5fe044628173d4e92c0d5d6 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Mon, 6 Nov 2023 13:31:04 +0530 Subject: [PATCH] fix: focus getting removed from description while typing --- web/components/issues/draft-issue-form.tsx | 6 ++---- web/components/issues/draft-issue-modal.tsx | 10 +--------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/web/components/issues/draft-issue-form.tsx b/web/components/issues/draft-issue-form.tsx index cea8a6fb0..bf6af11a1 100644 --- a/web/components/issues/draft-issue-form.tsx +++ b/web/components/issues/draft-issue-form.tsx @@ -132,7 +132,6 @@ export const DraftIssueForm: FC = (props) => { control, getValues, setValue, - setFocus, } = useForm({ defaultValues: prePopulatedData ?? defaultValues, reValidateMode: "onChange", @@ -250,14 +249,12 @@ export const DraftIssueForm: FC = (props) => { }; useEffect(() => { - setFocus("name"); - reset({ ...defaultValues, ...(prePopulatedData ?? {}), ...(data ?? {}), }); - }, [setFocus, prePopulatedData, reset, data]); + }, [prePopulatedData, reset, data]); // update projectId in form when projectId changes useEffect(() => { @@ -359,6 +356,7 @@ export const DraftIssueForm: FC = (props) => { id="name" name="name" type="text" + tabIndex={1} value={value} onChange={onChange} ref={ref} diff --git a/web/components/issues/draft-issue-modal.tsx b/web/components/issues/draft-issue-modal.tsx index a129cf96c..be3cb1f1c 100644 --- a/web/components/issues/draft-issue-modal.tsx +++ b/web/components/issues/draft-issue-modal.tsx @@ -46,15 +46,7 @@ const issueService = new IssueService(); const moduleService = new ModuleService(); export const CreateUpdateDraftIssueModal: React.FC = observer((props) => { - const { - data, - handleClose, - isOpen, - - prePopulateData: prePopulateDataProps, - fieldsToShow = ["all"], - onSubmit, - } = props; + const { data, handleClose, isOpen, prePopulateData: prePopulateDataProps, fieldsToShow = ["all"], onSubmit } = props; // states const [createMore, setCreateMore] = useState(false);