keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
376 stars 104 forks source link

bug(android): The globe key shows in an enabled state after selecting a default keyboard from the "Keyboard Picker." #11532

Closed dinakaranr closed 2 days ago

dinakaranr commented 1 month ago

Describe the bug

The globe key shows an enabled state after selecting a default keyboard from the "Keyboard Picker." This problem appears only if Keyman has more than one keyboard.

Reproduce the bug

Steps to reproduce:

  1. Installed the "Keyman-17.0.325.apk" stable file and gave all permissions to the application.
  2. Checked the "Enable Keyman as system-wide keyboard" and set the keyboard as the default keyboard box on the settings page.
  3. Installed the "Khmer angkor" keyboard by clicking Settings/Install Keyboard/Install from keyman.com.
  4. Change the keyboard from Khmer to English by short-pressing the globe key.
  5. Open the "Keyboard Picker" dialog by long-pressing the globe key.
  6. Select the default keyboard (e.g., English) and then return to the keyman home screen.
  7. Here, the globe key appeared as an enabled state. It seems to be the wrong state of behavior. Please refer to the video file. https://github.com/keymanapp/keyman/assets/19683059/53922d78-ac08-4a77-b431-9e140212259f

Expected behavior

No response

Related issues

No response

Keyman apps

Keyman version

Keyman-17.0.325 stable

Operating system

No response

Device

No response

Target application

No response

Browser

No response

Keyboard name

english_eurolatin_sil

Keyboard version

No response

Language name

English

Additional context

No response

jahorton commented 1 week ago

The issue is that the picker-triggering longhold is triggered by Android code, and the picker triggers an Android-side change that pushes a new View / Activity to the front... interrupting the standard event flow. We don't get the "key up" event.

Things pass through here:

Android-side gesture detector method: https://github.com/keymanapp/keyman/blob/d6992097fda7daf9846286436d657c6e65c63e86/android/KMEA/app/src/main/java/com/keyman/engine/KMKeyboard.java#L312-L317

On the way to here, eventually:

https://github.com/keymanapp/keyman/blob/bed77111bb239c27ebc57c16974ae2c1c8031a06/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java#L539-L555

As things are, Web will naturally recover and cancel the globe-key highlighting on the next keypress regardless, even without a fix. It's not the prettiest situation, though. The best and cleanest way to "fix" this is to add a new call into JS to clear active highlighting whenever the picker is activated, given the moving parts involved.