From bba4cb2be68ae6ca71be987bf13f8c7834242221 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Wed, 4 May 2011 11:06:32 +0200 Subject: [PATCH] Popup: Partial fix for closing popup when trigger is clicked again. --- tests/visual/menu/popup.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/visual/menu/popup.js b/tests/visual/menu/popup.js index f57cba699..947888eec 100644 --- a/tests/visual/menu/popup.js +++ b/tests/visual/menu/popup.js @@ -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 ); -- 2.39.5