fix(web): keep focus on the item input when adding with the + button
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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()}
|
||||
>
|
||||
<PlusIcon className="size-5" strokeWidth={2.5} />
|
||||
</InputGroupButton>
|
||||
|
||||
Reference in New Issue
Block a user