From 410a09aec6760f1e8a01680e48424559babfa2ec Mon Sep 17 00:00:00 2001 From: BluemediaGER Date: Sun, 29 Oct 2023 22:36:07 +0100 Subject: [PATCH] Focus username field on load --- src/views/login/index.vue | 16 +++++++++++++++- src/views/webauthn-authenticate/index.vue | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index aaaf123..eda0df3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -29,6 +29,7 @@ -import { defineComponent } from "vue"; +import { defineComponent, ref, onMounted, nextTick } from "vue"; import Layout from "~/components/Layout.vue"; import ErrorBox from "~/components/ErrorBox.vue"; import type { KcContextBase } from "~/types/context"; @@ -96,6 +97,19 @@ export default defineComponent({ context: (window as any).kcContext as KcContextBase.Login, }; }, + setup() { + const focus = ref(null); + + onMounted(() => { + nextTick(() => { + focus.value.focus(); + }); + }); + + return { + focus, + }; + }, });