Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#2919 closed defect (fixed)

ComboBox widget input field loses focus after each character

Reported by: guest Owned by: haysmark
Priority: high Milestone: 0.9
Component: Dijit - Form Version: 0.4.2
Keywords: ComboBox focus Cc: [email protected]
Blocked By: Blocking:

Description (last modified by haysmark)

ComboBox? input field loses focus:

  • IE6 & IE7 (not Firefox)
  • After the selection list has been popped up and an entry chosen
  • User then tries to type more characters at the end of the list
  • after each character, input field loses focus and user must click in the field to type the next character
  • this does *not* happen if the popup list is not displayed.

To reproduce, I was able to use the nightly build test page for the AutoCompleter? widget (build dated 5/22):


  1. Use ComboBox? 2 (or 3, probably others) on that page
  2. Open the drop down list and select an entry
  3. Entry appears in the combobox entry field (it's selected)
  4. Place cursor at end of field and start typing. (Add to entry)
  5. After each character, the focus will go out of the entry field and it will not return unless I click back in the entry field myself.

In my application, the loss of focus does not occur unless I open the drop down list - if I just type in the box, I'm fine.

I've tried turning off auto-complete, but that doesn't seem to affect this. I am creating the combobox programatically and I set "autoComplete: false" - but the widget still seems to be doing the autocomplete - it keeps popping up the list as I type. Not sure if this is related.

I am also not using "forceValidOption" - user should be able to have any value in my combobox - including selecting an existing option and changing the value in the field.

This is a fairly serious bug for me. Any suggestions to help workaround it would be appreciated.

Change History (7)

comment:1 in reply to:  description Changed 15 years ago by guest

Also this is true in in the latest 0.9 svn branch. I found that by adding the following line in _showResultList I am able to bring the focus back

setTimeout(dojo.lang.hitch(this, this._tryFocus), 100); and commenting this._hideResultList();

This is the updated function

_showResultList: function(){

Our dear friend IE doesnt take max-height so we need to calculate that on our own every time var childs = this.optionsListNode.childNodes; if(childs.length){

var visibleCount = Math.min(childs.length,this.maxListLength);

with( {

display = ""; if(visibleCount == childs.length){

no scrollbar is required, so unset height to let browser calcuate it, as in css, overflow is already set to auto height = "";


show it first to get the correct[0]) FIXME: shall we cache the height of the item? height = visibleCount * dojo.html.getMarginBox(childs[0]).height +"px";

} width = (dojo.html.getMarginBox(this.domNode).width-2)+"px";

}, this, this.downArrowNode);



setTimeout(dojo.lang.hitch(this, this._tryFocus), 100);



comment:2 Changed 15 years ago by Douglas Hays

Component: WidgetsDijit
Milestone: 0.9
Owner: changed from bill to haysmark

comment:3 Changed 15 years ago by haysmark

Description: modified (diff)

comment:4 Changed 15 years ago by haysmark

Check the updated 0.9 link. I cannot reproduce this in IE7 with AutoCompleter? 2.

The autoComplete flag determines the behavior of the highlighting code. Notice as you type in the second AutoCompleter? the rest of the text gets filled in for you and is highlighted. This does not occur in the other boxes because they have autoComplete set to false. The popup appears in both instances by design.

comment:6 Changed 15 years ago by haysmark

Resolution: fixed
Status: newclosed

I can confirm that this issue occurs in 0.4.3. I tested it in 0.9 rev 8744 (see above link) and it was resolved at some point.

comment:7 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.