Skip to content
Permalink
Browse files

Popup: Partial fix for closing popup when trigger is clicked again.

  • Loading branch information
jzaefferer committed May 4, 2011
1 parent f519bc0 commit bba4cb2be68ae6ca71be987bf13f8c7834242221
Showing with 9 additions and 1 deletion.
  1. +9 −1 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 );

0 comments on commit bba4cb2

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