diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-05-06 19:21:13 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-05-07 00:43:07 +0200 |
commit | 28017052a497c4fc62f6bb518e0f39e71ee034c4 (patch) | |
tree | ab1a47bfe0ddbfe149bea892d36b050fadb53c4a /tests/visual/menu | |
parent | 476777f1e926d56547291abda642683513f92610 (diff) | |
download | jquery-ui-28017052a497c4fc62f6bb518e0f39e71ee034c4.tar.gz jquery-ui-28017052a497c4fc62f6bb518e0f39e71ee034c4.zip |
Popup: Fix the reopens-issue when clicking the trigger while popup is
visible, while still handling an actualy blur properly.
Diffstat (limited to 'tests/visual/menu')
-rw-r--r-- | tests/visual/menu/popup.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/visual/menu/popup.js b/tests/visual/menu/popup.js index 08088c994..a8238adb0 100644 --- a/tests/visual/menu/popup.js +++ b/tests/visual/menu/popup.js @@ -39,6 +39,7 @@ $.widget( "ui.popup", { this._bind(this.options.trigger, { keydown: function( event ) { // prevent space-to-open to scroll the page + // TODO do this only for a:ui-button? if (event.keyCode == $.ui.keyCode.SPACE) { event.preventDefault() } @@ -50,6 +51,7 @@ $.widget( "ui.popup", { return; } var that = this; + clearTimeout( this.closeTimer ); setTimeout(function() { that.open( event ); }, 1); @@ -57,9 +59,14 @@ $.widget( "ui.popup", { }); this._bind(this.element, { - // 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" + blur: function( event ) { + var that = this; + // use a timer to allow click to clear it and letting that + // handle the closing instead of opening again + that.closeTimer = setTimeout( function() { + that.close( event ); + }, 100); + } }); this._bind({ |