April 4, 2012 1

BlackBerry PlayBook JavaScript Keyboard Events Bug

By

Key Event bug

Whilst working on a PlayBook port of Rareloop‘s form framework for tablets I came across an interesting quirk with how the PlayBook OS handles keyboard events in input fields.

On all desktop browsers that I’ve tested (as well as iOS and Android) events are fired for each keystroke. This is useful if you wish to perform a task as a user types input, for example autocompletion hinting. On the PlayBook however, the event is only fired when a space key is entered and a word is completed. This seems to be the case for keydown, keyup & keypress events on OS2, I can’t confirm whether this is new in OS2 or if its always been the case.

I’ve created a test case on JSFiddle to demonstrate the issue.

The problem has been reported to RIM, so hopefully this will be addressed in a future OS update.


Update: Thanks to Hin for pointing out in the comments that there is a work around for this bug when using input elements. If you add the autocomplete="off" attribute then the events fire as expected. Unfortunately this doesn’t work for textarea elements.

Here is an updated JSFiddle to show the fix.

  • Hin

    I just came across the same issue, and after realizing that the same events fire on Google and Bing, I found that these events do fire when you set autocomplete=”off” for input. However, I still couldn’t get it to work with textarea.