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

Callback onUnMask calls too many times when set autoUnmask: true and using with FomanticUI form! #2810

Open
KiddoV opened this issue Aug 5, 2024 · 2 comments

Comments

@KiddoV
Copy link

KiddoV commented Aug 5, 2024

Describe the bug

I have encountered a weird behavior when using the FUI form with the Inputmask plugin. When I set {autoUnmask: true} in Inputmask, the {onUnMask: (mVal, umVal)} method is called every time I interact with the form, such as focusing on any fields or changing input values in any fields. I would expect it to be called only when I change the input in its own field.

I am not sure if this conflict is due to FUI or if the problem lies with Inputmask.

Additionally, when I set {removeMaskOnSubmit: true} without the {autoUnmask: true} option, the value is not unmasked after submission.

Add a link to a codepen, jsfiddle or other example page which shows the problem

Here is my JSFiddle:
https://jsfiddle.net/KiddoV/rLb0f6nh/60/

Additional notes

According to @lubber - Owner of FUI:

This line is causing it
https://github.com/fomantic/Fomantic-UI/blob/fb2d8fcbc3f4de690f6df6a75a76452a8bf7e1a2/src/definitions/behaviors/form.js#L376
It is called to check for the dirty state on each blur/click/keyup/down event in FUI.
However, just accessing .val() to get the fields content is somehow causing inputmask to trigger their unmask event. From the jquery docs for .val i cannot tell why this is happening as no event is triggered by jquery. I think this needs investigation in the inputmask project.

@RobinHerbots
Copy link
Owner

@KiddoV ,

Everytime the library request the value it will trigger the unmasking, when using the autoUnmask: true. This is logical ans I can not change that behavior from my end.

But what is too many? Do you get an error or so?

@KiddoV
Copy link
Author

KiddoV commented Aug 28, 2024

@RobinHerbots There's no error or anything, it's just the onUnMask get call too many time. Not sure if that is OK if I just leave it like that in my app?

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

2 participants