diff --git a/docs/app/components/content/examples/form/FormExampleOnError.vue b/docs/app/components/content/examples/form/FormExampleOnError.vue index f02d140666..0eeee68714 100644 --- a/docs/app/components/content/examples/form/FormExampleOnError.vue +++ b/docs/app/components/content/examples/form/FormExampleOnError.vue @@ -22,8 +22,10 @@ async function onSubmit(event: FormSubmitEvent) { async function onError(event: FormErrorEvent) { if (event?.errors?.[0]?.id) { const element = document.getElementById(event.errors[0].id) - element?.focus() - element?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + setTimeout(() => { + element?.focus() + element?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + }, 0) } }