text-mask: backspace don't erase fixed characters on mask (only version 7.0.0 using ion-input)
mask config:
[/\d/, /\d/, '.', /\d/, /\d/]
so the value without mask is: __.__
So i start to write and now the value is: 11.11 (on model the value is 11.111, but this is another bug already related earlier)
Then i try to erase the field using backspace, but i can’t because when the value is 11.__, backspace don’t work anymore. It happen everytime i have a fixed character on mask, like the '.'
to solve the problem i downgraded the version to 6.0.0 and it worked
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 8
- Comments: 16 (3 by maintainers)
Commits related to this issue
- Fix for issue #480: Only set input element if we don't have it — committed to ajcrites/text-mask by ajcrites 7 years ago
- Fix for issue #480: Only set input element if we don't have it (#555) * Fix for issue #480: Only set input element if we don't have it * Remove unnecesary inputElement checks — committed to text-mask/text-mask by ajcrites 7 years ago
This issue still exists for the react implementation.
Any update on this? I’m having the same issue on React. I can’t delete static characters using only backspace when guide is off.
Any update on this issue for react?
The demo has this problem: https://text-mask.github.io/text-mask/
To reproduce, type into box until the closing
)appears and then try and delete characters using backspaceI found a workaround
https://github.com/text-mask/text-mask/issues/230#issuecomment-381350161
Some more info: I’m seeing the issue when I call
setStateinonChangeIt happens even if I do not modify state (i.e.this.setState(previousState => previousState)). I also tried hooking into a different event (onKeyUp) and saw the same behavior.I am seeing this too and setting
guideto true doesn’t fix it so it’s possibly different from #483. As best as I can tell, if you have a value(720)in the input and hit backspace, the onChange handler gets passed the value(720but then text-mask will immediately add back the closing parentheses so net effect nothing happens. I’m guessing text-mask should somehow ignore the mask characters? I will keep playing with it but hope that helps.