Skip to content
Permalink
Browse files

Popup: Fix the reopens-issue when clicking the trigger while popup is

visible, while still handling an actualy blur properly.
  • Loading branch information...
jzaefferer committed May 6, 2011
1 parent 476777f commit 28017052a497c4fc62f6bb518e0f39e71ee034c4
Showing with 10 additions and 3 deletions.
  1. +10 −3 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,16 +51,22 @@ $.widget( "ui.popup", {
return;
}
var that = this;
clearTimeout( this.closeTimer );
setTimeout(function() {
that.open( event );
}, 1);
}
});

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({

0 comments on commit 2801705

Please sign in to comment.
You can’t perform that action at this time.