From 39aafbb34ae55f433e2b6c855eb91ab941b732a4 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2025 00:52:37 +0100 Subject: [PATCH] web/flow: grab focus to uid input field (cherry-pick #13177) (#13178) web/flow: grab focus to uid input field (#13177) Signed-off-by: Jens Langhammer Co-authored-by: Jens L. --- 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();