Просмотр исходного кода

Merge pull request #1846 from tpruvot/master

issue #1778: prevent delayed focus when the list is hidden
Igor Vaynberg 11 лет назад
Родитель
Сommit
fc4bbbb5ef
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      select2.js

+ 3 - 1
select2.js

@@ -1992,7 +1992,9 @@ 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() {
-                        this.search.focus();
+                        if (this.opened()) {
+                            this.search.focus();
+                        }
                     }), 0);
                 }
             }));