Fix Bug 39829 - Language Selection does not work while using Language Code

This happens when you type language code and hit enter very fast, without
a pause. A matched language is not available when enter is hit, so it goes
noop.

Handled this special case by checking whether the input is a valid language
code and calling onselect on it.

Change-Id: Icaf809f8db8162264d990247a164449b02b2f418
This commit is contained in:
Santhosh Thottingal
2012-09-03 14:32:04 +05:30
parent 01b41b9783
commit 3609e1f42e

View File

@@ -70,8 +70,16 @@
} }
break; break;
case 13: case 13:
if ( this.options.onSelect && this.selectedLanguage ) { if ( !this.options.onSelect ) {
break;
}
if ( this.selectedLanguage ) {
// this.selectLanguage will be populated from a matching search
this.options.onSelect( this.selectedLanguage ); this.options.onSelect( this.selectedLanguage );
} else if ( this.options.languages[this.$element.val()] ) {
// Search is yet to happen(in timeout delay),
// but we have a matching language code.
this.options.onSelect( this.$element.val() );
} }
break; break;
default: default: