diff --git a/kitsune/sumo/static/sumo/js/form-wizard-sign-in-step.js b/kitsune/sumo/static/sumo/js/form-wizard-sign-in-step.js index 74d5d39c004..1bbdb8866de 100644 --- a/kitsune/sumo/static/sumo/js/form-wizard-sign-in-step.js +++ b/kitsune/sumo/static/sumo/js/form-wizard-sign-in-step.js @@ -36,7 +36,7 @@ export class SignInStep extends BaseFormStep {
- +
@@ -69,7 +69,6 @@ export class SignInStep extends BaseFormStep { this.#formEl.addEventListener("submit", this); this.#emailEl.addEventListener("blur", this); this.#emailEl.addEventListener("input", this); - this.#emailEl.focus(); } disconnectedCallback() { @@ -169,6 +168,18 @@ export class SignInStep extends BaseFormStep { } } + // If we've reached the point where we've got hasUpdatedFxAState set true, + // this means that we've confirmed that we're running on a non-disqualified + // version of Firefox Desktop. If focus hasn't moved anywhere else in the + // meantime, we'll move focus to the email field if it's never been moved + // there before. + if (this.state.hasUpdatedFxAState && this.#emailEl.hasAttribute("pending-autofocus")) { + this.#emailEl.removeAttribute("pending-autofocus"); + if (document.activeElement == document.body) { + this.#emailEl.focus(); + } + } + let alternativeLinks = this.shadowRoot.querySelectorAll(".alternative-link"); for (let link of alternativeLinks) { link.href = this.state.linkHref; diff --git a/kitsune/sumo/static/sumo/js/form-wizard.js b/kitsune/sumo/static/sumo/js/form-wizard.js index 341e4b07e13..ed060e9487e 100644 --- a/kitsune/sumo/static/sumo/js/form-wizard.js +++ b/kitsune/sumo/static/sumo/js/form-wizard.js @@ -55,7 +55,7 @@ export class FormWizard extends HTMLElement { static get markup() { return `