mirror of
https://github.com/Cian-H/am-d-model.eu.git
synced 2025-12-22 21:41:57 +00:00
Tweaked hotkey implementations
This commit is contained in:
@@ -5,11 +5,7 @@
|
||||
export let hotkey = "";
|
||||
|
||||
function handleKeypress(event) {
|
||||
if (
|
||||
event.key === hotkey ||
|
||||
event.key === "Enter" ||
|
||||
event.key === " "
|
||||
) {
|
||||
if (event.key === hotkey) {
|
||||
event.preventDefault();
|
||||
redirectFunc();
|
||||
}
|
||||
@@ -18,9 +14,9 @@
|
||||
|
||||
<div
|
||||
class="cursor-pointer select-none {$$props.class}"
|
||||
style="cursor: pointer;"
|
||||
style="cursor:pointer"
|
||||
on:click={redirectFunc}
|
||||
on:keydown={handleKeypress}
|
||||
on:keypress={handleKeypress}
|
||||
tabindex="0"
|
||||
role="button"
|
||||
>
|
||||
|
||||
@@ -78,6 +78,12 @@
|
||||
placeholder="Carl Deckard"
|
||||
bind:value={formData.name}
|
||||
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:border-red-500={errors.name}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user