Merge pull request #114 from EETagent/handle_for_submit_buttons

(frontend) click event on enter for submit buttons
This commit is contained in:
Vojtěch Jungmann 2023-01-01 14:44:58 +01:00 committed by GitHub
commit 978aea863a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,21 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
export let value: string;
const dispatch = createEventDispatcher();
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') {
dispatch('click');
}
};
</script>
<input on:click type="submit" {value} />
<svelte:window on:keydown={handleKeyDown} />
<style lang="postcss">
input {
@apply bg-sspsBlue hover:bg-sspsBlueDark