FIX: Dropdown dismissing on middle click.

This commit is contained in:
Guo Xiang Tan 2015-07-22 13:04:37 +08:00
parent 6053a0c4af
commit e1a8e32127
1 changed files with 7 additions and 2 deletions

View File

@ -76,11 +76,16 @@ export default Discourse.View.extend({
$dropdown.find('input[type=text]').focus().select();
$html.on('click.d-dropdown', function(e) {
return $(e.target).closest('.d-dropdown').length > 0 ? true : hideDropdown.apply(self);
return $(e.target).closest('.d-dropdown').length > 0 ? true : hideDropdown();
});
$dropdown.on('click.d-dropdown', function(e) {
return $(e.target).closest('a').not('.search-link, .filter-type').length > 0 ? hideDropdown.apply(self) : true;
if(e.which === 1 &&
$(e.target).closest('a').not('.search-link, .filter-type').length > 0) {
return hideDropdown();
} else {
return true;
}
});
$html.data('hide-dropdown', hideDropdown);