forked from jquery/jquery-ui
-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Labels
Description
Hi
I discovered a bug in the _typeahead method. If a list has multiple entries that start with the same letters, for example 'al', it will go to the last option starting with 'al'.
It's because of this part:
if ( thisText === matchee ) {
if ( self._typeAhead_cycling ) {
if ( nextIndex === null )
nextIndex = i;
if ( i > selectedIndex ) {
nextIndex = i;
break;
}
} else {
nextIndex = i;
}
}
Becuase there is no 'break;' in the else part of that statement, is doesn't get out of the for loop.
So change it to this:
if ( thisText === matchee ) {
if ( self._typeAhead_cycling ) {
if ( nextIndex === null )
nextIndex = i;
if ( i > selectedIndex ) {
nextIndex = i;
break;
}
} else {
nextIndex = i;
break;
}
}
Add fixed. The first option that matches will be selected.
Cheers :)