From: hannes Date: Mon, 15 Oct 2012 08:46:16 +0000 (+0800) Subject: attempt to fix eventPropagation issue when toogle X-Git-Tag: selectmenu_v1.4.0~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=690bbee3f0798ba944111f46d10f540803b7f224;p=jquery-ui.git attempt to fix eventPropagation issue when toogle --- diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index ef0a11eea..8ff847b59 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -90,10 +90,11 @@ $.widget("ui.selectmenu", { self._safemouseup = false; setTimeout(function() { self._safemouseup = true; }, 300); } - return false; + + event.preventDefault(); }) .bind('click.selectmenu', function() { - return false; + event.preventDefault(); }) .bind("keydown.selectmenu", function(event) { var ret = false; @@ -161,7 +162,8 @@ $.widget("ui.selectmenu", { // document click closes menu $(document).bind("mousedown.selectmenu-" + this.ids[0], function(event) { - if ( self.isOpen ) { + //check if open and if the clicket targes parent is the same + if ( self.isOpen && self.ids[1] != event.target.offsetParent.id) { self.close( event ); } }); @@ -869,4 +871,4 @@ $.widget("ui.selectmenu", { } }); -})(jQuery); +})(jQuery); \ No newline at end of file