From 3609e1f42e84178c6204d4ab0f299f48e4facf3c Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Mon, 3 Sep 2012 14:32:04 +0530 Subject: [PATCH] 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 --- lib/jquery.uls/src/jquery.uls.languagefilter.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/jquery.uls/src/jquery.uls.languagefilter.js b/lib/jquery.uls/src/jquery.uls.languagefilter.js index e5b06503..f918c8e9 100644 --- a/lib/jquery.uls/src/jquery.uls.languagefilter.js +++ b/lib/jquery.uls/src/jquery.uls.languagefilter.js @@ -70,8 +70,16 @@ } break; 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 ); + } 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; default: