x-mask ($money) not working when deleting digits with <backspace> or <delete> #2872
Replies: 7 comments 10 replies
-
estou com o mesmo problema! |
Beta Was this translation helpful? Give feedback.
-
It's hacky, but to work around this issue, I just blur/focus the input on keyup. "x-on:keyup": "$refs.input.blur(); $refs.input.focus()" |
Beta Was this translation helpful? Give feedback.
-
Came across this today too. Fixes would be appreciated 🙏 |
Beta Was this translation helpful? Give feedback.
-
The bug continues :(, lost 3 hours trying to make my custom mask work and found out that its a bug with x-mask... |
Beta Was this translation helpful? Give feedback.
-
So this isn't actually a bug, but part of the design. If a mask like 99/99/99 exists, it auto adds the / once you type two numbers, but the user may want to delete the slash and edit the first numbers again. That's a usability requirement. So the value isn't masked when it is getting smaller, to allow backspaces to remove mask added characters. |
Beta Was this translation helpful? Give feedback.
-
Just solved the 'issue' creating my own Alpine Directive with the custom mask. Worked like a charm. |
Beta Was this translation helpful? Give feedback.
-
@wevertondcl can you share it? |
Beta Was this translation helpful? Give feedback.
-
When I enter something into a field
which is also referenced somewhere with
<span x-text="sparplanBetrag"></span>
x-mask does work perfectly when just adding digits.
It does not work when deleting digits with or keys though.
Interestingly, when leaving the field x-mask is applied again within the field, but not in the -Tag.
I guess x-mask should work whenever something is changed in the input field and it should always be reflected in all references?
Beta Was this translation helpful? Give feedback.
All reactions