Opened 6 years ago

Last modified 3 years ago

#17537 new defect

dijit.form.Select: error if keypress and less than two options

Reported by: Stanislav_Strelchik Owned by:
Priority: undecided Milestone: 1.15
Component: Dijit - Form Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

We have a dijit.form.Select on our form. When it contains less than 2 options than key press leads to an error:

For example, in FF 17.0.10 esr:

Timestamp: 10/30/2013 5:50:12 PM
Error: TypeError: item is null
Source File: https://dojotoolkit.org/reference-guide/1.9/_static/js/dijit/_KeyNavMixin.js
Line: 285

This error occurs inside a loop in _keyboardSearch function:

do{
  var rc = this._keyboardSearchCompare(currentItem, searchString);
  if(!!rc && numMatches++ == 0){
    matchedItem = currentItem;
  }
  if(rc == -1){ // priority match
    numMatches = -1;
    break;
  }
  currentItem = this._getNextFocusableChild(currentItem, 1);
}while(currentItem != stop);

It happens when this._getNextFocusableChild(currentItem, 1) returns null and on the next iteration of the loop calls this._keyboardSearchCompare(currentItem, searchString) with null currentItem.

Steps to reproduce:

  1. Open attached sample.
  2. Select 'Tennessee' option.
  3. Press a few keys.

Attachments (1)

dojo_select.html (596 bytes) - added by Stanislav_Strelchik 6 years ago.
dijit.form.Select sample with 1 option from "https://dojotoolkit.org/reference-guide/1.9/dijit/form/Select.html"

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by Stanislav_Strelchik

Attachment: dojo_select.html added

dijit.form.Select sample with 1 option from "https://dojotoolkit.org/reference-guide/1.9/dijit/form/Select.html"

comment:1 Changed 4 years ago by jvoccia

We just ran across this one too: http://jsfiddle.net/tv2gs37b/2/ TypeError?: 'null' is not an object (evaluating '_14.domNode')

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.12

We should investigate and fix in 1.12 if possible. Pull requests are welcome of course!

comment:3 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.