Skip to content

Commit

Permalink
fix: pin input callback
Browse files Browse the repository at this point in the history
  • Loading branch information
paring-chan committed Jan 5, 2025
1 parent adbb5f8 commit 1538b46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/components/form/PINInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { FormEventHandler } from 'svelte/elements'
import FormHint from './FormHint.svelte'
import Translation from '$lib/utils/Translation.svelte'
import { tick } from 'svelte'
interface Props {
length: number
Expand Down Expand Up @@ -35,7 +36,9 @@
v += c
}
onfinish?.(v)
tick().then(() => {
onfinish?.(v)
})
}
const onKeyDown = (e: KeyboardEvent) => {
Expand Down Expand Up @@ -131,7 +134,7 @@
{#each Array.from({ length }) as _, i}
<input
class="item"
value={value[i]}
value={value[i] ?? ''}
oninput={onInput}
onkeydown={onKeyDown}
{disabled}
Expand Down

0 comments on commit 1538b46

Please sign in to comment.