diff --git a/src/routes/registration/+page.svelte b/src/routes/registration/+page.svelte index 9a84db8..4ed6ab9 100644 --- a/src/routes/registration/+page.svelte +++ b/src/routes/registration/+page.svelte @@ -2,6 +2,7 @@ import { RunnerService, type ResponseRunner } from '@odit/lfk-client-js'; import bwipjs from 'bwip-js'; import lfkbackground from './background.png'; + import { onMount } from 'svelte'; $: firstname = ''; $: lastname = ''; @@ -11,6 +12,23 @@ let response: ResponseRunner; const group = 1; //Default to Bürgerlauf + function focusFirstName() { + setTimeout(() => { + document.getElementById('firstname')?.focus(); + }, 50); + setTimeout(() => { + document.getElementById('firstname')?.focus(); + }, 100); + } + function focusDoneButton() { + setTimeout(() => { + document.getElementById('done')?.focus(); + }, 50); + setTimeout(() => { + document.getElementById('done')?.focus(); + }, 100); + } + async function register() { try { response = (await RunnerService.runnerControllerPost({ @@ -20,6 +38,7 @@ })) as ResponseRunner; showError = false; showResult = true; + focusDoneButton(); } catch (error) { console.log(error); showError = true; @@ -46,6 +65,10 @@ }); return canvas.toDataURL('image/png'); } + + onMount(() => { + focusFirstName(); + });
-
+