Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#12645 closed enhancement (fixed)

Select: focus selected value when opening dropDown

Reported by: Karl Tiedt Owned by: Douglas Hays
Priority: high Milestone: 1.8
Component: Dijit - Form Version: 1.6.0
Keywords: dijit.form.Select dropdown focus Cc:
Blocked By: Blocking:


Native <select>s when you open them w/a long list, always focuses to the current value, however dijit Select does not... it always sets the dropdown scroll to the first element in the dropdown

Hot fix currently implemented to achieve this:

(function(Select) {
  Select._odd = Select.openDropDown;
  Select.openDropDown = function() {
    this._odd.apply(this, arguments);

    this.dropDown.focus = function() {
      var s = dojo.filter(this.getChildren(), function(o) {
        return o.option && o.option.selected;

      if (s) {
      } else {


Change History (6)

comment:1 Changed 11 years ago by bill

Summary: dijit.form.Select does not focus current value when opening dropDownSelect: focus selected value when opening dropDown
Type: defectenhancement

I thought we had a ticket about this but can't find it now. Maybe it was about FilteringSelect and got closed because it was impossible/impractical with the API.

comment:2 Changed 11 years ago by Douglas Hays

Milestone: tbd1.7

comment:3 Changed 11 years ago by Douglas Hays

Milestone: 1.71.8

comment:4 Changed 10 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

In [28040]:

Fixes #12645. Select now focuses previous menu item instead of first. Updated automated tests to reflect same.

comment:5 Changed 9 years ago by MikeyLightning

Good day!

Hi there in Dojo land. My name is Mike, and I am a software developer in Denver, Colorado. I am currently working with a client who is experiencing the above-described problem in Dojo 1.6.1, and unfortunately they are not in a position to upgrade their enterprise to 1.8 in order to get the fixed code.

In the ticket above, I see that there is a "hot fix" patch mentioned. I'd love to be able to provide that exact hotfix to my client, but- I'm not at all sure where in the Dojo code to make the change. We've been searching through the 1.6.1 Dojo source, but haven't had any luck.

If someone out there happens to know where in the 1.6.1 code that hotfix goes, and could point me at it, we would REALLY appreciate it (and if you happen to be in Denver, I'll even offer to buy you a few beers).

Thanks!!! -Mike

comment:6 Changed 9 years ago by bill

That hotfix goes in the client code, not the dojo code. This is known as "monkey-patching".

Note: See TracTickets for help on using tickets.