Key Events not trickling up

We are taking a look at mollett’s report of events not always being managed correctly:

[quote]I have noticed that key events don’t always seem to trickle up to a parent element. I have run this code on a D40 with firmware 1_3_0_1_53901. The attached code attaches handlers for key left and key right. There are also soft keys for Next and Prev (corresponding to left and right). When changing direction (like from left to right), it requires to presses of the dpad key to cause the onkey event to fire. No such issue is exhibited when using the soft keys.

To reproduce:
1- create test.js and app.json from snippets below
2- create file
3- upload to phone
4- run application
5-note that right arrow key must be pressed twice in order to move from initial screen. also not in debug window that only one “prevVerse” event fired, despite the 2 key presses.
6- close application and relaunch
7- press the “Prev” soft key one time and note that the screen changes.[/quote]

If it makes it easier, here is the minimal app that shows what I meant.


Thanks for the attaching that zip file. I tried it out and was able to confirm what you reported. So, as you reported, something is specifically interfering with the arrow keys on the dpad. As long as you don’t need your phone app to process those keys you should be good.

But…I’ll look into it (probably tomorrow) and see if I can find out what is really happening. Let me know if this is holding up any development that you’re working on.


This is not holding me up in the least! I’ve got my app written, but the client won’t be getting it until the end of the month. And, I can disable the arrows and just use the soft keys if I need to. Thanks!


P.S. Did you happen to notice the excessive amount of padding at the bottom of the scroll box?

The problem here is that the code uses genericMenu, probably just to set softkeys. genericMenu creates a List widget, which in this case is left empty. Empty lists have a bug where a right or down key gets consumed (basically moving from a no-selection-yet state to selecting row 0).

I’d recommend using window.setSoftkeysByList to set up softkeys in your application instead of using an empty genericMenu. We’ll look into fixing the empty List bug in a future revision.

Shaun has a fixed version of the bug report code here:

setSoftkeysByList description is here

That approach works beautifully, Matt. Here’s a reference implementation…