]> source.dussan.org Git - jquery-ui.git/commitdiff
Popup: Partial fix for closing popup when trigger is clicked again.
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 4 May 2011 09:06:32 +0000 (11:06 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 4 May 2011 09:06:32 +0000 (11:06 +0200)
tests/visual/menu/popup.js

index f57cba699fe7a126485eaae072eb95c3b512d05a..947888eec558e305e6811b5b7ad7ce04784e32f4 100644 (file)
@@ -39,6 +39,10 @@ $.widget( "ui.popup", {
                this._bind(this.options.trigger, {
                        click: function( event ) {
                                event.preventDefault();
+                               if (this.open) {
+                                       // let it propagate to close
+                                       return;
+                               }
                                var that = this;
                                setTimeout(function() {
                                        that._open( event );
@@ -47,10 +51,14 @@ $.widget( "ui.popup", {
                });
                
                this._bind(this.element, {
-                       blur: "_close"
+                       // TODO also triggered when open and clicking the trigger again
+                       // figure out how to close in that case, while still closing on regular blur
+                       //blur: "_close"
                });
 
                this._bind({
+                       // TODO only triggerd on element if it can receive focus
+                       // bind to document instead?
                        keyup: function( event ) {
                                if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
                                        this._close( event );