Can't use tab keys to select the first list item in a list box

asked 2011-07-15 08:27:40 +0800

tvella gravatar image tvella
87 3

updated 2011-07-15 08:30:12 +0800


I am trying to write an application which can be easily navigated via the keyboard to improve accessiblity. I have created a listbox and am having difficulty being able to navigate to it via the tab key from my ZK v5.0.7.1 interface. The objective is to navigate to the first list item in the list box. Once the item is selected (using the tab key) I then should be able to use the up and down arrow keys to navigate across items in the list box. Fortunately the issue can be replicated in your ZK sandbox examples.

Specifically, refering to the Listbox example:

1. Left click on the drop down box containing a list of mail box folders. The one containing options such as "Inbox", 'Received" and "Draft".
2. Then attempt to navigate to the email listbox just below using the tab key. You will find that ZK completely ignores the listbox.

This is unintuitive behaviour. I tried to programmatically set the focus of the first list item but I still can't seem to get the listbox into focus and be able to use the up and down key to traverse its list items.

Any help would be appreciated.

delete flag offensive retag edit

3 Replies

Sort by » oldest newest

answered 2011-07-19 05:27:58 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2011-07-19 05:31:59 +0800

The Current ZK version doesn't support this feature. Would you post the feature here?

link publish delete flag offensive edit

answered 2011-07-19 06:39:40 +0800

cvarona gravatar image cvarona
554 1 6

In zul listboxes are translated into tables so they're not directly focusable (unlike their dropwdown counterpart, which gets translated into the corresponding html list component). If your listbox contains at least one item you can write an onBlur listener that focus the first listitem (or just skips the list and focus the next component, should it be empty). This is the solution I've applied for years, inconvenient though it is. It would be great if zk offered such a functionality out of the box.

With kind regards

César Varona

link publish delete flag offensive edit

answered 2011-07-19 06:46:36 +0800

tvella gravatar image tvella
87 3

Thank you César. Your suggestion sounds like it will fly. I will give it a go and post a reply if it doesn't work for me.
Best regards,

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-07-15 08:27:40 +0800

Seen: 631 times

Last updated: Jul 19 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More