diff --git a/src/components/tools/DonationCreate.svelte b/src/components/tools/DonationCreate.svelte index e8808880..de6163e4 100644 --- a/src/components/tools/DonationCreate.svelte +++ b/src/components/tools/DonationCreate.svelte @@ -168,6 +168,10 @@ document.querySelector("#button_new_donor").focus(); document.querySelector("#button_new_donor").click(); } + if (e.key === "Enter") { + e.preventDefault(); + document.querySelector("#zt12c3udy3bme5bqobmqcif1").focus(); + } }} id="button_existing_donor" class:bg-indigo-600={!donor_create_new} @@ -187,12 +191,19 @@ document.querySelector("#button_existing_donor").focus(); document.querySelector("#button_existing_donor").click(); } + if (e.key === "Enter") { + e.preventDefault(); + document.querySelector("#button_new_donor").click(); + } }} id="button_new_donor" class={`py-2 px-4 w-1/2 transition-colors ${donor_create_new ? "bg-indigo-600 text-white" : "bg-gray-100 text-gray-700"}`} on:click={() => { donor_create_new = true; donorinfo = { id: 0, firstname: "", lastname: "" }; + setTimeout(() => { + document.querySelector("#firstname").focus(); + }, 50); }} > {$_("new-donor")} @@ -218,8 +229,12 @@ inputPlaceholder={$_("search-for-donor")} noOptionsText={$_("no-donors-found")} on:onSelected={(data) => { + console.log(data.detail); if (data.detail !== null) { document.querySelector("#submit_button").focus(); + setTimeout(() => { + document.querySelector("#submit_button").focus(); + }, 100); } }} /> @@ -236,6 +251,11 @@ { + if (e.key === "Enter") { + document.querySelector("#lastname").focus(); + } + }} bind:value={donorinfo.firstname} class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm border-neutral-300 border bg-neutral-50 text-neutral-800 p-2" placeholder={$_("first-name")}