apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Special characters are not working after upgrading to cordova-android 12 #1676

Closed moianra23 closed 6 months ago

moianra23 commented 6 months ago

Bug Report

Problem

After upgrading from cordova-android 11.0.0 to cordova-android 12.0.1 the special characters are not working from the keyboard (example after longpressing the a button, all the characters that appear can be pressed but the event is not sent in js).

What is expected to happen?

I expect after I'm pressing the ä, ö, ü characters to be entered in the focused input.

What does actually happen?

Right now it does nothing.

Information

I tried to catch the event in js in multiple ways, however it looks like it's not triggered. My project uses angular 15 and I tried to catch the event through multiple events (keyDown, keyUp, and even js's addEventListener) and nothing. The only thing that changed is the cordova-android version which I had to do in order to publish the app in play store.

Environment, Platform, Device

I'm using macOS Ventura to build the project. And problem is reproduced on both emulator and physical devices from the device/emulator keyboard. If I connect an external keyboard it works.

Version information

macOS Ventura 13.6 node: 16.16.0 npm: 8.11.0 "cordova": "11.1.0", "cordova-android": "^12.0.1", "@angular/core": "15.2.9", (all the other angular dependencies are matching this version)

Android API 34

Checklist

jcesarmobile commented 6 months ago

Is the character put in the field but the event doesn’t fire or the character is not put into the field neither?

moianra23 commented 6 months ago

Is the character put in the field but the event doesn’t fire or the character is not put into the field neither?

Nothing is being put in the field. Nothing happens.

breautek commented 6 months ago

I don't think this is related to Cordova. Cordova is pretty much just a package manager that packages web assets into a native shell and loads them in to the standard OS webview with a plugin interface. Virtually all DOM behaviour is entirely controlled by the webview implementation and/or the web application itself and is not something that Cordova can really influence. So this doesn't really make a whole lot of sense.

Is this reproducible in a sample test application? If so, that would be the best way to demonstrate the bug without influence of angular, your application or any other library you might be using and it might be easier to track down the root issue.

jcesarmobile commented 6 months ago

Some native code can prevent special characters from working on input fields or text areas. But I couldn't find that code inside cordova-android, so might be some plugin or some dependency that cordova-android uses and was updated and the new version includes the problem. So a sample app would help.

moianra23 commented 6 months ago

Some native code can prevent special characters from working on input fields or text areas. But I couldn't find that code inside cordova-android, so might be some plugin or some dependency that cordova-android uses and was updated and the new version includes the problem. So a sample app would help.

I couldn't find the code either. With cordova-android11 it worked though. I'll create a test app and submit it.

moianra23 commented 6 months ago

Nevermind. I found the issue while trying to recreate the problem in another project. The problem was that someone overridden the SystemWebView class in order to fix some issue regarding the keydown events. It seems like that fix was compatible with cordova-android 11 but with cordova-android 12 it wasn't needed anymore. Removing it fixed both this issue and the old one. Thanks for the help.