From e1a8e32127040a03f635bbc4ccee88f848c022d6 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 22 Jul 2015 13:04:37 +0800 Subject: [PATCH] FIX: Dropdown dismissing on middle click. --- app/assets/javascripts/discourse/views/header.js.es6 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/header.js.es6 b/app/assets/javascripts/discourse/views/header.js.es6 index d2cfdb9322a..125e6de38e5 100644 --- a/app/assets/javascripts/discourse/views/header.js.es6 +++ b/app/assets/javascripts/discourse/views/header.js.es6 @@ -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);