UX: Dropdown not dismissing until next page renders.

This commit is contained in:
Guo Xiang Tan 2015-06-26 23:16:21 +08:00
parent 1edb5919fa
commit 7ce77a151c
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,7 @@ export default Discourse.View.extend({
controller.set('visibleDropdown', null); controller.set('visibleDropdown', null);
} }
$html.off('click.d-dropdown'); $html.off('click.d-dropdown');
$dropdown.off('click.d-dropdown');
}; };
// if a dropdown is active and the user clicks on it, close it // if a dropdown is active and the user clicks on it, close it
@ -78,6 +79,10 @@ export default Discourse.View.extend({
return $(e.target).closest('.d-dropdown').length > 0 ? true : hideDropdown.apply(self); return $(e.target).closest('.d-dropdown').length > 0 ? true : hideDropdown.apply(self);
}); });
$dropdown.on('click.d-dropdown', function(e) {
return $(e.target).closest('a').not('.search-link').length > 0 ? hideDropdown.apply(self) : true;
});
$html.data('hide-dropdown', hideDropdown); $html.data('hide-dropdown', hideDropdown);
return false; return false;