Autofocus the sign-in-step email field for the switching-devices wizard

Fixes mozilla/sumo#1614.
This commit is contained in:
Mike Conley 2023-12-13 12:19:05 -05:00
Родитель 6c71e7a764
Коммит 0802db19d4
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -69,6 +69,8 @@ export class SignInStep extends BaseFormStep {
this.#formEl.addEventListener("submit", this);
this.#emailEl.addEventListener("blur", this);
this.#emailEl.addEventListener("input", this);
this.#emailEl.focus();
}
disconnectedCallback() {

Просмотреть файл

@ -92,6 +92,11 @@ describe("sign-in-step custom element", () => {
assertFormElements(form, EXPECTED_FORM_ELEMENTS_WITH_FLOW_METRICS);
});
it("should focus the email field automatically", () => {
let email = step.shadowRoot.querySelector("#email");
expect(step.shadowRoot.activeElement).to.equal(email);
});
it("should set an email address if one is set in the state", () => {
const TEST_STATE = {
utm_source: "utm_source",