On some devices (mostly Samsung, but others too) and combinations of: Android version, WebView version (even with the evergreen WebView in Android 7) and keyboard, there are a number of issues:
keypress isn't firedkeydown and keyup always contain keyCode=229
keypress and input are fired but don't contain the keytextInput isn't firedmaxlength attribute isn't honored on input[type=text] while the user types (more than maxlength chars are allowed and the input is validated only when the form is submitted)Is there a way to fix these issues?
I found that if you extend WebView and override onCreateInputConnection, all of those issues are fixed:
public class WebViewExtended extends WebView {
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
// This line fixes some issues but introduces others, YMMV.
// super.onCreateInputConnection(outAttrs);
return new BaseInputConnection(this, false);
}
}
Before overriding onCreateInputConnection:

After overriding onCreateInputConnection (g was pressed):

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With