mirror of
https://github.com/Cian-H/am-d-model.eu.git
synced 2025-12-23 05:51:57 +00:00
Tweaked hotkey implementations
This commit is contained in:
@@ -5,11 +5,7 @@
|
|||||||
export let hotkey = "";
|
export let hotkey = "";
|
||||||
|
|
||||||
function handleKeypress(event) {
|
function handleKeypress(event) {
|
||||||
if (
|
if (event.key === hotkey) {
|
||||||
event.key === hotkey ||
|
|
||||||
event.key === "Enter" ||
|
|
||||||
event.key === " "
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
redirectFunc();
|
redirectFunc();
|
||||||
}
|
}
|
||||||
@@ -18,9 +14,9 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class="cursor-pointer select-none {$$props.class}"
|
class="cursor-pointer select-none {$$props.class}"
|
||||||
style="cursor: pointer;"
|
style="cursor:pointer"
|
||||||
on:click={redirectFunc}
|
on:click={redirectFunc}
|
||||||
on:keydown={handleKeypress}
|
on:keypress={handleKeypress}
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -78,6 +78,12 @@
|
|||||||
placeholder="Carl Deckard"
|
placeholder="Carl Deckard"
|
||||||
bind:value={formData.name}
|
bind:value={formData.name}
|
||||||
on:input={handleInput}
|
on:input={handleInput}
|
||||||
|
on:keypress={() => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
event.preventDefault;
|
||||||
|
handleSubmit();
|
||||||
|
}
|
||||||
|
}}
|
||||||
class="w-full text-lg px-3 py-2 rounded-md border-[1px] border-solid border-gray-300 hover:border-blue-500 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full text-lg px-3 py-2 rounded-md border-[1px] border-solid border-gray-300 hover:border-blue-500 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
class:border-red-500={errors.name}
|
class:border-red-500={errors.name}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user