зеркало из 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.#emailEl.addEventListener("blur", this);
|
||||
this.#emailEl.addEventListener("input", this);
|
||||
|
||||
this.#emailEl.focus();
|
||||
this.activate();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
|
@ -80,6 +79,11 @@ export class SignInStep extends BaseFormStep {
|
|||
this.#emailEl.removeEventListener("input", this);
|
||||
}
|
||||
|
||||
activate() {
|
||||
this.#emailErrorEl.classList.remove("visible");
|
||||
this.#emailEl.focus();
|
||||
}
|
||||
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "blur": {
|
||||
|
|
|
@ -302,6 +302,7 @@ export class FormWizard extends HTMLElement {
|
|||
let name = step.getAttribute("name");
|
||||
if (name === activeStep) {
|
||||
step.slot = "active";
|
||||
step.activate && step.activate();
|
||||
} else {
|
||||
step.slot = "";
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче