From 2e65f3bb5e561d1d44290b42d43312b52341c45b Mon Sep 17 00:00:00 2001 From: pennae Date: Sat, 23 Jul 2022 22:12:02 +0200 Subject: auto-focus input fields --- web/js/main.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'web') diff --git a/web/js/main.js b/web/js/main.js index cefb003..edb41b1 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -252,6 +252,10 @@ class CredentialsForm extends HTMLElement { })); }); } + + connectedCallback() { + this.querySelector("form")['email'].focus(); + } }; customElements.define('credentials-form', CredentialsForm); @@ -331,6 +335,10 @@ class SigninConfirm extends HTMLElement { } }); } + + connectedCallback() { + this.shadowRoot.querySelector("form")['code'].focus(); + } }; customElements.define('do-signin-confirm', SigninConfirm); @@ -360,6 +368,10 @@ class ResetPassword extends HTMLElement { switchTo(new ResetPasswordCreate(frm['email'].value, reset_token.accountResetToken)); }); } + + connectedCallback() { + this.shadowRoot.querySelector("form")['email'].focus(); + } }; customElements.define('do-resetpw', ResetPassword); @@ -378,9 +390,14 @@ class ResetPasswordCreate extends HTMLElement { } let c = new AuthClient(client_config.auth_server_base_url); await c.accountReset(email, frm['new'].value, reset_token); + window.location.hash = ""; switchTo(new Signin()); }; } + + connectedCallback() { + this.shadowRoot.querySelector("form")['new'].focus(); + } }; customElements.define('do-resetpw-create', ResetPasswordCreate); @@ -622,6 +639,10 @@ class SettingsChangePassword extends HTMLElement { alert("password changed"); }); } + + connectedCallback() { + this.querySelector("form")['old'].focus(); + } }; customElements.define('do-settings-chpw', SettingsChangePassword); -- cgit v1.2.3