From a732063f1bf8eda3fc4dfd0b1cbabb94b432e8ff Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 5 Dec 2014 17:05:59 -0500 Subject: [PATCH] Fix bug where elements in select2 drop cannot be focused This chrome workaround had the undesired side-effect of preventing anything in the select2 drop from being focused (affected single but not multi selects for some reason). Making the condition more specific to the actual problem being worked around solves this. --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 7c918e99..2d3cb429 100644 --- a/select2.js +++ b/select2.js @@ -2181,7 +2181,7 @@ the specific language governing permissions and limitations under the Apache Lic // without this the search field loses focus which is annoying if (document.activeElement === this.body.get(0)) { window.setTimeout(this.bind(function() { - if (this.opened()) { + if (this.opened() && this.results && this.results.length > 1) { this.search.focus(); } }), 0);