-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
InputMask: on Android does not fire onChange until focus lost #2686
Comments
So when you say Mobile Chrome 99 is that on iOS or Android? |
Sorry, its Android. Not tested on iOS |
OK because in INputMask.js I see code like this...
And
So I have a feeling some custom mobile browser handling is wrong. You might want to peek at InputMask.js and see if you see anything obvious. |
There is even a method called handleAndroidInput(e) {
let curVal = this.inputRef.current.value;
let pos = this.caret();
if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) {
// a deletion or backspace happened
this.checkVal(true);
while (pos.begin > 0 && !this.tests[pos.begin - 1])
pos.begin--;
if (pos.begin === 0) {
while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin])
pos.begin++;
}
this.caret(pos.begin, pos.begin);
} else {
this.checkVal(true);
while (pos.begin < this.len && !this.tests[pos.begin])
pos.begin++;
this.caret(pos.begin, pos.begin);
}
if (this.props.onComplete && this.isCompleted()) {
this.props.onComplete({
originalEvent: e,
value: this.getValue()
});
}
} |
Yeah, it looks like that function does not call updateModel(), like the non-android one does, but I'm not familiar enough with this project to say if it should be called. Hopefully someone else will chime in... |
I feel like it probably should will leave it up to PrimeTek though. I don't have an Android device to test on so I don't want to suggest any fixes. |
I analyzed this deeper and you are right the normal path calls updateModel but Android does not. Will be fixed in RC2 |
There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
https://codesandbox.io/s/inputmask-not-updating-nz7s5k
Current behavior
On mobile only, InputMask does not fire the onChange event until the component loses focus
Expected behavior
onChange is fired with each keystroke
Minimal reproduction of the problem with instructions
The bug seems to only be reproducable on a real mobile browser. It does not appear when using a desktop browser with a mobile device type emulated (e.g. via Chrome devtools). It also does not appear when using actual mobile Chrome but with "Request Desktop Site" enabled.
Please tell us about your environment:
Windows 11, VS Code
React version:
17.0.2
PrimeReact version:
7.2.1
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Mobile Chrome 99
Language: [all | TypeScript X.X | ES6/7 | ES5]
TypeScript 4.5.5
The text was updated successfully, but these errors were encountered: