diff --git a/src/components/form/paymentForm.tsx b/src/components/form/paymentForm.tsx index 87bacb1..3963d75 100644 --- a/src/components/form/paymentForm.tsx +++ b/src/components/form/paymentForm.tsx @@ -179,7 +179,7 @@ export default function PaymentForm({value, entities, categories, onSubmit, clas // only focus category input if payee has no default category if (entity?.defaultCategoryId !== null) { form.setValue('categoryId', entity?.defaultCategoryId); - setTimeout(() => categoryRef.current.blur(), 0); + submitRef && submitRef.current.focus(); } else { categoryRef && categoryRef.current.focus(); } @@ -201,7 +201,14 @@ export default function PaymentForm({value, entities, categories, onSubmit, clas + {...field} + onChange={(e) => { + field.onChange(e); + if (e && e.target.value) { + submitRef && submitRef.current.focus(); + } + }} + /> @@ -223,7 +230,8 @@ export default function PaymentForm({value, entities, categories, onSubmit, clas )} /> - + );