From 8d4e7f5d55033d1cbbd8936d47e41d3dc218caa4 Mon Sep 17 00:00:00 2001 From: "Jens L." Date: Sun, 23 Feb 2025 00:29:31 +0100 Subject: [PATCH] web/flow: grab focus to uid input field (#13177) Signed-off-by: Jens Langhammer --- web/src/flow/components/ak-flow-password-input.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/flow/components/ak-flow-password-input.ts b/web/src/flow/components/ak-flow-password-input.ts index de88721372..2e40ead2db 100644 --- a/web/src/flow/components/ak-flow-password-input.ts +++ b/web/src/flow/components/ak-flow-password-input.ts @@ -193,6 +193,9 @@ export class InputPassword extends AKElement { * the `autofocus` attribute isn't enough, due to timing within shadow doms and such. */ observeInputFocus(): void { + if (!this.grabFocus) { + return; + } this.inputFocusIntervalID = setInterval(() => { const input = this.inputRef.value; @@ -219,7 +222,9 @@ export class InputPassword extends AKElement { } disconnectedCallback() { - clearInterval(this.inputFocusIntervalID); + if (this.inputFocusIntervalID) { + clearInterval(this.inputFocusIntervalID); + } super.disconnectedCallback();