text-mask icon indicating copy to clipboard operation
text-mask copied to clipboard

Fix onChange not Firing when Deleting All Text

Open bbrinx opened this issue 5 years ago • 10 comments

When deleting the entire value of a field at once, e.g. cmd+backspace, onChange is not called. This is most likely due to value being an empty string, so when the text is deleted the new value is also an empty string, resulting in not raising a change event.

Changing defaultValue to value worked for me, but it fails the unit tests. This is just meant as a way to illustrate the problem and hint at a solution. I would appreciate if someone could look into this.

Addresses issue #992

bbrinx avatar Dec 05 '19 19:12 bbrinx

This should be merged. Can someone from the lib authors make a review ?

peculiarity avatar Feb 26 '20 09:02 peculiarity

Waiting for the merge too. Thx

FlorianBurgevin avatar Apr 28 '20 14:04 FlorianBurgevin

Hello @themzed

Some news on subject ?

I found a similar problem, the initial value is empty and i changed the controlled value but the mask isn't updated on first time.

Hope this fix will solve the pb.

FlorianBurgevin avatar May 05 '20 08:05 FlorianBurgevin

Hello @themzed Something new ?

FlorianBurgevin avatar May 26 '20 07:05 FlorianBurgevin

Hey @FlorianBurgevin, Unfortunately this repo isn't maintained anymore.

moharnadreza avatar May 26 '20 14:05 moharnadreza

@themzed Oh really ? Why ? :(

FlorianBurgevin avatar May 26 '20 14:05 FlorianBurgevin

Yeah, I'm not really up to date about that but it's on the readme file. @FlorianBurgevin

moharnadreza avatar May 26 '20 20:05 moharnadreza

Ok thanks @themzed ! Hope you'll have time later to update some small fixes.

FlorianBurgevin avatar May 27 '20 07:05 FlorianBurgevin

Thanks you too, I'd love to but unfortunately I don't have access to merge PRs @FlorianBurgevin

moharnadreza avatar May 27 '20 13:05 moharnadreza

Have same issue using with Formik. Passing defaultValue prop to MaskedInput solve the problem <MaskedInput defaultValue={''}

pscherbinov avatar Mar 15 '21 12:03 pscherbinov