From 37d1cc65466e63cb7ac7e8245c290e60b11804c6 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 20 Oct 2015 09:40:01 +0200 Subject: [PATCH] fix select2 closing problem in the facet sidebar --- .../src/main/js/libs/third-party/select2.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/server/sonar-web/src/main/js/libs/third-party/select2.js b/server/sonar-web/src/main/js/libs/third-party/select2.js index 213f4cf930a..8975c0ea4c2 100644 --- a/server/sonar-web/src/main/js/libs/third-party/select2.js +++ b/server/sonar-web/src/main/js/libs/third-party/select2.js @@ -962,15 +962,17 @@ var cid = this.containerId, selector = this.containerSelector, scroll = "scroll." + cid, resize = "resize." + cid; - this.container.parents().each(function() { - $(this).bind(scroll, function() { - var s2 = $(selector); - if (s2.length == 0) { - $(this).unbind(scroll); - } - s2.select2("close"); + setTimeout(function () { + this.container.parents().each(function() { + $(this).bind(scroll, function() { + var s2 = $(selector); + if (s2.length == 0) { + $(this).unbind(scroll); + } + s2.select2("close"); + }); }); - }); + }.bind(this), 100); $(window).bind(resize, function() { var s2 = $(selector); @@ -1401,6 +1403,7 @@ // single close: function () { if (!this.opened()) return; + console.log('closing...'); this.parent.close.apply(this, arguments); this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show(); }, -- 2.39.5