зеркало из https://github.com/mozilla/kitsune.git
move focus and validation logic to an 'activate' method
This commit is contained in:
Родитель
e0c09e7264
Коммит
6c2174fdb3
|
@ -69,8 +69,7 @@ export class SignInStep extends BaseFormStep {
|
||||||
this.#formEl.addEventListener("submit", this);
|
this.#formEl.addEventListener("submit", this);
|
||||||
this.#emailEl.addEventListener("blur", this);
|
this.#emailEl.addEventListener("blur", this);
|
||||||
this.#emailEl.addEventListener("input", this);
|
this.#emailEl.addEventListener("input", this);
|
||||||
|
this.activate();
|
||||||
this.#emailEl.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
@ -80,6 +79,11 @@ export class SignInStep extends BaseFormStep {
|
||||||
this.#emailEl.removeEventListener("input", this);
|
this.#emailEl.removeEventListener("input", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
this.#emailErrorEl.classList.remove("visible");
|
||||||
|
this.#emailEl.focus();
|
||||||
|
}
|
||||||
|
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "blur": {
|
case "blur": {
|
||||||
|
|
|
@ -302,6 +302,7 @@ export class FormWizard extends HTMLElement {
|
||||||
let name = step.getAttribute("name");
|
let name = step.getAttribute("name");
|
||||||
if (name === activeStep) {
|
if (name === activeStep) {
|
||||||
step.slot = "active";
|
step.slot = "active";
|
||||||
|
step.activate && step.activate();
|
||||||
} else {
|
} else {
|
||||||
step.slot = "";
|
step.slot = "";
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче