From 388c8c8becdef4c51f9d7d2641c4c11ff8226861 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 22 Feb 2021 19:26:50 +0100 Subject: [PATCH] web: fix autofocus in ak-form-element --- web/src/elements/stages/form.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/elements/stages/form.ts b/web/src/elements/stages/form.ts index e696edbf1..a49b1f883 100644 --- a/web/src/elements/stages/form.ts +++ b/web/src/elements/stages/form.ts @@ -19,6 +19,12 @@ export class FormElement extends LitElement { @property({ attribute: false }) errors?: Error[]; + updated(): void { + this.querySelectorAll("input[autofocus]").forEach(input => { + input.focus(); + }); + } + render(): TemplateResult { return html`