JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.16k stars 300 forks source link

Android: FormControl not updating when using Samsung Keyboard app #1293

Open hv-pul opened 11 months ago

hv-pul commented 11 months ago

🐞 bug report

Is this a regression?

No

Description

When using ngx-mask, inputs via the Samsung Keyboard app are not registered until the field is blurred.

Expected behavior Inputs that are bound to a FormControl should behave the same when using ngx-mask as default inputs.

Observed behavior The FormControl value does not update until field is blurred.

🔬 Minimal Reproduction

https://stackblitz.com/edit/stackblitz-starters-c2wvcg?file=src%2Fmain.ts

(FYI: The Stackblitz template that you link to is out of date, this is using the latest Angular & ngx-mask versions instead).

🌍 Your Environment

Angular Version:


17.07 (issue exists on 15.10 as well)

Anything else relevant?

We observed this behavior on Android 13 in Chrome 120.0.6099.115

The reason seems to be that Samsung Keyboard sends insertCompositionText events on typing, not insertText events, so ngx-mask sets _isComposing and skips updates. Google Gboard and Microsoft Swift keyboard apps work fine.

When not using ngx-mask, the behavior is different, so we think it would might correct to skip running the mask logic on insertCompositionText, but the original value should still be reflected to the FormControl.