Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputOtp: When you paste a value into InputOtp, it is duplicating #6545

Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@GabriellDatacamp
Copy link
Contributor

GabriellDatacamp commented May 2, 2024

Describe the bug

The value it is duplicating, overwriting even the length of InputOtp.

Reproducer

https://stackblitz.com/edit/3vj3go?file=src%2FApp.jsx

PrimeReact version

10.6.4

React version

18.x

Language

TypeScript

Build / Runtime

Next.js

Browser(s)

No response

Steps to reproduce the behavior

Paste any value into InputOtp

Expected behavior

Waits for inputotp to receive the value that was pasted

@GabriellDatacamp GabriellDatacamp added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 2, 2024
@Rekl0w
Copy link
Contributor

Rekl0w commented May 2, 2024

Your stackblitz link is not working, can you check again ?

@melloware melloware added Status: Needs Reproducer Issue needs a runnable reproducer and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 2, 2024
Copy link

github-actions bot commented May 2, 2024

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

@GabriellDatacamp
Copy link
Contributor Author

Reproducer Fixed

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Reproducer Issue needs a runnable reproducer labels May 2, 2024
melloware added a commit that referenced this issue May 2, 2024
… values (#6526)

* Fix: Remove setTokens in onPaste on InputOtp to avoid duplicate values

- When pasted the value into InputOtp, was duplicating the value, as the state was updated in onPaste and onInput

* Update InputOtp.js

---------

Co-authored-by: Datacamp <sistemas@datacamp.net.br>
Co-authored-by: Melloware <mellowaredev@gmail.com>
@melloware
Copy link
Member

Thanks I tested and updated your PR a better way of handling it to work on both Firefox and Chrome.

@melloware
Copy link
Member

10.6.5 is out if you want to test again please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment