An unusual Google Keyboard bug

submited by
Style Pass
2024-11-08 08:00:03

There's a subtle bug that happens when you're using Gboard (the Google keyboard) on Android on certain websites. Watch what happens after I type test into the Guardian crossword, and try to delete the word:

Normally, when you type a letter e.g. 't', the browser should fire a keydown event with keyCode 84, and then a keyup event with keyCode 84. Typing a backspace is similar, except the keyCode is 8.

However, Gboard has a peculiar behaviour where when it's generating autocomplete suggestions, backspaces always have keyCode 229 - Unidentified. But once it's not generating suggestions, backspaces have the correct keyCode 8.

This breaks any code that listens for any specific keyCode, e.g. if it's listening for the Backspace key by listening for keyCode 8. This is also why backspaces worked after pressing it 4 times - once the word "test" was cleared from the autocomplete suggestions, the correct keyCode 8was fired

In Chrome, all letters have keyCode 229. In Firefox, typing letters generate the correct keyCode, but backspaces still have keyCode 229, but with keyname Process.

Leave a Comment