Diacritics get cleaned up on iOS Safari Webview when a mask allows for them and regular letters
Arahvin opened this issue · comments
- Describe the bug
When using a mask to allow letters, numbers, letters with diacritics and whitespaces on iOS, whenever I type in a sequence of diacritics and then a non-accented letter, the previous diacritics are removed and replaced.
I am using Inputmask on a Cordova hybrid app, and on Safari Webview there is an issue with diacritics. From what I could investigate, the way iOS handles the keydown, keyup and keypress slightly differently. I couldn't understand it is intended behavior on Apple's part, but what is happening is that on the keydown/keyup events the keycode of a pressed diacritic is aways 0. Which will mean it will be considered an ignorable (since 0 is on the array of ignorables). On the keypress event, the keycode has the correct value. What I did as a workaround was validade the ignorable bit at the beginning of the keypress event, instead of at the end of the keydown event on eventhandlers.js. It works for my scenario but I am not sure if it will break something else down the road. Wouldn't think so by looking at the code surrounding this bit, but I am not all that familiar with the full code.
- OS: iOS 15.4
- Browser: Safari Webview
- Inputmask version: 5.0.7