Skip to content

Commit 2ad2820

Browse files
author
Guy Lister
committed
Prevent dropdown from disappearing when mouse downed on scrollbar. (Tested in IE8.)
1 parent 7f4724d commit 2ad2820

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

js/bootstrap-combobox.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,16 @@
122122
})
123123
.show();
124124

125+
$('.dropdown-menu').on('mousedown', $.proxy(this.scrollSafety, this));
126+
125127
this.shown = true;
126128
return this;
127129
}
128130

129131
, hide: function () {
130132
this.$menu.hide();
133+
$('.dropdown-menu').off('mousedown', $.proxy(this.scrollSafety, this));
134+
this.$element.on('blur', $.proxy(this.blur, this));
131135
this.shown = false;
132136
return this;
133137
}
@@ -230,6 +234,11 @@
230234
}
231235
}
232236

237+
, scrollSafety: function(e) {
238+
if (e.target.tagName == 'UL') {
239+
this.$element.off('blur');
240+
}
241+
}
233242
, clearElement: function () {
234243
this.$element.val('').focus();
235244
}

0 commit comments

Comments
 (0)