浏览代码

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.
colemanw 10 年之前
父节点
当前提交
a732063f1b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      select2.js

+ 1 - 1
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
                 // without this the search field loses focus which is annoying
                 if (document.activeElement === this.body.get(0)) {
                 if (document.activeElement === this.body.get(0)) {
                     window.setTimeout(this.bind(function() {
                     window.setTimeout(this.bind(function() {
-                        if (this.opened()) {
+                        if (this.opened() && this.results && this.results.length > 1) {
                             this.search.focus();
                             this.search.focus();
                         }
                         }
                     }), 0);
                     }), 0);