Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16579 closed enhancement (duplicate)

[patch] Select: allow type ahead

Reported by: Bob Tarling Owned by: Douglas Hays
Priority: undecided Milestone: tbd
Component: Dijit - Form Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


Attached is a new contribution to provide type ahead ability in a Dojo Select control.

What I wanted to do was provide the same kind of type ahead ability that is available in a simple html select but with with the look and feel and other features of the Dojo Select.

I provide this as a new KeyboardSelect? control extending the standard Select control (hence I just supply the new file rather than a patch). This ensures there is no issue with backwards compatibility of the Select control for those who may not want this feature.

I placed it in the dojox package, if this contribution is accepted I guess that is the place it would go. Alternatively I would be happy to rework this as a patch to the actual Select control if that is preferred.

I'm also attaching a simple test script. This is also online where you can test this now -

The control allows an option to be selected by pressing the first letter of that option label. If the user types another character within 600ms that character is appended to the previous keystroke for the subsequent search. If the user pauses long enough the type ahead goes back to just the single character.

This works if the drop down is visible or if the control simply has focus without the drop down visible.

This is my first contribution and I'd be very happy to accept any criticism to improve this if required. A contributors agreement will follow by email.

Attachments (2)

KeyboardSelect.js (2.0 KB) - added by Bob Tarling 9 years ago.
New KeyboardSelect? control that extends Select
KeyboardSelectDemoSimple.html (1.2 KB) - added by Bob Tarling 9 years ago.
Demo script for the KeyboardSelect? control

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by Bob Tarling

Attachment: KeyboardSelect.js added

New KeyboardSelect? control that extends Select

Changed 9 years ago by Bob Tarling

Demo script for the KeyboardSelect? control

comment:1 Changed 9 years ago by bill

Might be able to leverage dijit/_KeyNavContainer for the select's drop down list. Doug recently added letter key search capability to it. In that case it's probably suitable for dijit.

comment:2 Changed 9 years ago by Bob Tarling

Please adjust the component field value appropriately on this ticket if dijit is the preferred way to go. I could make my next step a patch to the Select control if that is preferred (even though I provided the code as an extension it seems not the right way to add such a feature to me)

I'm keen to contribute but I would appreciate a little steering. Is there a Dojo developers list I can join to help make sure I provide as required or should we keep discussion to this ticket?

comment:3 Changed 9 years ago by bill

Component: DojoX FormDijit - Form
Owner: changed from dante to Douglas Hays
Summary: [patch] Allow type ahead in Select[patch] Select: allow type ahead

OK, let's try for dijit, and thanks for being keen to contribute. There is a dojo-contributors mailing list but I think writing on the ticket is fine too. There's also #dojo on

comment:4 Changed 9 years ago by Douglas Hays

Doesn't Select in trunk (1.9) already do this?

comment:5 Changed 9 years ago by Bob Tarling

I thought someone might beat me to this, I must be quicker next time :-)

Still, its been a good learning experience.

If nobody confirms this is in 1.9 before I get a chance I will confirm back here myself. For my work so far I was working on the latest public 1.8.3 release. I'll go get a subversion extract. I found instructions here - - will my user will have read access (clearly I won't be able to commit)?

comment:6 Changed 9 years ago by Douglas Hays

Resolution: duplicate
Status: newclosed

comment:7 Changed 9 years ago by Bob Tarling

I notice #10251 does not allow type ahead when the Select control has focus but does not have the list dropped down. A simple html control allows type ahead in this state as does the control I provided.

I will see if I can work out how to resolve just this part with what is currently in svn. All tickets are now closed. Would you prefer such a patch goes to a new ticket or should one of these reopen?

comment:8 Changed 9 years ago by Douglas Hays

A new ticket please

Note: See TracTickets for help on using tickets.