Browse Source

Feed back the keypress code that was responsible for the 'close' even… (#5513)

* Feed back the keypress code that was responsible for the 'close' event s part of the event parameters

* Update core.js
Ben McIntyre 5 years ago
parent
commit
3b69d358dc
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/js/select2/core.js

+ 3 - 3
src/js/select2/core.js

@@ -331,7 +331,7 @@ define([
       if (self.isOpen()) {
       if (self.isOpen()) {
         if (key === KEYS.ESC || key === KEYS.TAB ||
         if (key === KEYS.ESC || key === KEYS.TAB ||
             (key === KEYS.UP && evt.altKey)) {
             (key === KEYS.UP && evt.altKey)) {
-          self.close();
+          self.close(evt);
 
 
           evt.preventDefault();
           evt.preventDefault();
         } else if (key === KEYS.ENTER) {
         } else if (key === KEYS.ENTER) {
@@ -474,12 +474,12 @@ define([
     this.trigger('query', {});
     this.trigger('query', {});
   };
   };
 
 
-  Select2.prototype.close = function () {
+  Select2.prototype.close = function (evt) {
     if (!this.isOpen()) {
     if (!this.isOpen()) {
       return;
       return;
     }
     }
 
 
-    this.trigger('close', {});
+    this.trigger('close', { originalEvent : evt });
   };
   };
 
 
   Select2.prototype.isOpen = function () {
   Select2.prototype.isOpen = function () {