Browse Source

Merge pull request #2176 from mattslocum/master

Fix Focus war with modals
Igor Vaynberg 11 years ago
parent
commit
e51e7a64ba
1 changed files with 2 additions and 1 deletions
  1. 2 1
      select2.js

+ 2 - 1
select2.js

@@ -773,7 +773,8 @@ the specific language governing permissions and limitations under the Apache Lic
             // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
             // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
             // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
             // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
             // dom it will trigger the popup close, which is not what we want
             // dom it will trigger the popup close, which is not what we want
-            this.dropdown.on("click mouseup mousedown", function (e) { e.stopPropagation(); });
+            // focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
+            this.dropdown.on("click mouseup mousedown focusin", function (e) { e.stopPropagation(); });
 
 
             this.nextSearchTerm = undefined;
             this.nextSearchTerm = undefined;