Buttons

General Information

smallicon-textinc This list is incomplete - you can help by expanding it!
  • Most buttons do not repeat their keydown event.
  • For some reason, keyboard events do not fire when the device is in sleep mode. This is only a problem if headphones are plugged in with media controls.

Bugs

Events Not Firing

Sometimes, keydown and keyup events will randomly stop firing; any inputs are just completely ignored, including keyups. This happens most frequently on low end devices. Although rare, this can also happen on the higher end devices as well.

What's strange is that the OS does not freeze at all - inputs are just outright rejected for some reason.

There is no workaround for this at the moment, besides keeping your app as light as possible and encouraging users to clear their memory.

Special Keys

smallicon-warning This table is missing images - you can help by creating them!

This table lists buttons that have special behaviours or have special names.
"Button Key" is k.key in the event object for keydown/keyup.

Button Button Key Picture Notes
Back Backspace img This key is unavailable when a text input (ex. <input>) with text in it is focused.
End Call EndCall img Don't preventDefault() this key.
This key is only available on devices with a dedicated back button.
(Start) Call Call img
OK/Center Soft Key Enter
MicrophoneToggle
img Holding this key will invoke Google Assistant on most devices.
Listen for the Enter button, not MicrophoneToggle - it is unknown why the OK key sends two keydown events.
Arrow Keys ArrowUp/Down/Left/Right img These keys repeat their keydown event.
Soft Left/Right SoftLeft / SoftRight img May force exit fullscreen from requestFullscreen() on some devices.
Volume Rocker VolumeDown / VolumeUp img Only available on some devices.
These keys repeat their keydown event.
Messages/Shortcut (none) img You cannot listen to this key.
This key is only available on some devices.
Media Pause/Play/Previous/Next MediaPause/Play/Previous/Next img Only occurs when the app is in the foreground, the device is on, and a headset with media controls is connected.

See also

Keyboard Events on BananaHackers Wiki

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License