Allow enter keypress to submit login form

This commit is contained in:
Andrew Kingston 2021-05-21 13:27:27 +01:00
parent c3daa8bc61
commit 5c950291f3
3 changed files with 10 additions and 1 deletions

View File

@ -82,6 +82,7 @@
on:blur
on:focus
on:input
on:keyup
on:blur={onBlur}
on:focus={onFocus}
on:input={onInput}

View File

@ -34,5 +34,6 @@
on:input
on:blur
on:focus
on:keyup
/>
</Field>

View File

@ -33,6 +33,12 @@
notifications.error("Invalid credentials")
}
}
const submitOnEnter = e => {
if (e.key === "Enter") {
login()
}
}
</script>
<div class="login">
@ -46,12 +52,13 @@
<Divider noGrid />
<Layout gap="XS" noPadding>
<Body size="S" textAlign="center">Sign in with email</Body>
<Input label="Email" bind:value={username} />
<Input label="Email" bind:value={username} on:keyup={submitOnEnter} />
<Input
label="Password"
type="password"
on:change
bind:value={password}
on:keyup={submitOnEnter}
/>
</Layout>
<Layout gap="XS" noPadding>