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

Unable to paste values without mask from clipboard #1063

Open
pyymenta opened this issue Aug 1, 2024 · 0 comments
Open

Unable to paste values without mask from clipboard #1063

pyymenta opened this issue Aug 1, 2024 · 0 comments

Comments

@pyymenta
Copy link

pyymenta commented Aug 1, 2024

Bug Description
I encountered and unexpected behavior with several custom Inputs using react-imasked. When attempting to paste a value without a mask, the onChange callback fails to trigger.

I have created a CodePen demo to illustrate this issue:

onchange-paste

View Demo

Initially, I attempted to address this by adding an onPaste event to invoke the same onChange method callback. However, this approach resulted in an empty value being returned:

Incorrect onPaste Behavior

To resolve this, I implemented a workaround using setTimeout, which successfully achieved the expected behavior:

Correct onPaste Behavior with setTimeout

Despite its effectiveness, the setTimeout solution is not ideal. I am reaching out to address this issue and inquire if there is a better way to resolve it. Thank you for your assistance!

Steps to Reproduce

Codepen Demo

  1. Open the provided CodePen demo.
  2. Open the codepen console.
  3. Paste a value without a mask into the input field.

Expected Behavior
The onChange event should trigger when pasting a value without a mask.

Environment:

  • OS: Linux
  • Browser: Chrome, Version 127.0.6533.88 64-bit
  • IMask Version: 7.6.1
  • Framework/Plugin: React 18.3.1

Additional Context
Include any additional relevant information about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant