Skip to content

Commit 34e5c69

Browse files
committed
No need to hack select2, fixes popover logic instead
1 parent 3baa7a1 commit 34e5c69

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

assets/ui/js/popover.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@
165165
/*
166166
* Bind events
167167
*/
168-
this.$container.on('mousedown', function(e){
169-
e.stopPropagation();
170-
})
171-
172168
this.$container.on('close.oc.popover', function(e){
173169
self.hide()
174170
})
@@ -317,9 +313,14 @@
317313
return result
318314
}
319315

320-
Popover.prototype.onDocumentClick = function() {
321-
if (this.options.closeOnPageClick)
322-
this.hide();
316+
Popover.prototype.onDocumentClick = function(e) {
317+
if (!this.options.closeOnPageClick)
318+
return
319+
320+
if ($.contains(this.$container.get(0), e.target))
321+
return
322+
323+
this.hide();
323324
}
324325

325326
Popover.DEFAULTS = {

assets/ui/vendor/select2/OCTOBER-README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

assets/ui/vendor/select2/js/select2.full.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ S2.define('select2/selection/base',[
13871387
BaseSelection.prototype._attachCloseHandler = function (container) {
13881388
var self = this;
13891389

1390-
$(document.body).on('click.select2.' + container.id, function (e) {
1390+
$(document.body).on('mousedown.select2.' + container.id, function (e) {
13911391
var $target = $(e.target);
13921392

13931393
var $select = $target.closest('.select2');
@@ -1409,7 +1409,7 @@ S2.define('select2/selection/base',[
14091409
};
14101410

14111411
BaseSelection.prototype._detachCloseHandler = function (container) {
1412-
$(document.body).off('click.select2.' + container.id);
1412+
$(document.body).off('mousedown.select2.' + container.id);
14131413
};
14141414

14151415
BaseSelection.prototype.position = function ($selection, $container) {

0 commit comments

Comments
 (0)