Skip to content

Commit

Permalink
PINCodeInput: Fixes paste on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanbrook committed Dec 3, 2024
1 parent ae92c0d commit 8ac45fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/PINCodeInput/PINCodeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const PINCodeInput = (props: PINCodeInputProps) => {
const curr = [...value]
curr[idx] = character

// Don't advance the cursor if the character is empty
if (character !== '') {
inputRefs[idx + 1]?.current?.focus()
}
Expand Down Expand Up @@ -98,6 +99,8 @@ export const PINCodeInput = (props: PINCodeInputProps) => {
idx: number,
ev: React.ClipboardEvent<HTMLInputElement>
) => {
ev.preventDefault()

const pasted = ev.clipboardData.getData('text/plain')
const filtered = pasted.replace(/\D/g, '')
const re = new RegExp(`^\\d{${digits}}$`)
Expand Down

0 comments on commit 8ac45fd

Please sign in to comment.