From b7fa9308315d4c8ac6b8acb020edc376b5ddf735 Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Mon, 19 Oct 2026 15:05:41 -0300 Subject: [PATCH] fix(web): keep focus on the item input when adding with the + button Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/items/create-item-form.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/web/src/components/items/create-item-form.tsx b/apps/web/src/components/items/create-item-form.tsx index 6fbc5bd..0fdeab5 100644 --- a/apps/web/src/components/items/create-item-form.tsx +++ b/apps/web/src/components/items/create-item-form.tsx @@ -60,6 +60,7 @@ export function CreateItemForm({ listId, autoFocus = false }: CreateItemFormProp // can be typed in a row; if the request fails the text comes back with the error. const onSubmit = form.handleSubmit((values) => { form.reset() + form.setFocus('name') createItem.mutate(values, { onError: (error) => { form.setValue('name', values.name) @@ -97,6 +98,9 @@ export function CreateItemForm({ listId, autoFocus = false }: CreateItemFormProp size="icon-sm" aria-label="Agregar" className="size-10 rounded-full" + // Tapping the button must not steal the focus from the input: on mobile that + // would close the keyboard between one item and the next. + onMouseDown={(event) => event.preventDefault()} >