Skip to content

Commit bba4cb2

Browse files
committed
Popup: Partial fix for closing popup when trigger is clicked again.
1 parent f519bc0 commit bba4cb2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/visual/menu/popup.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ $.widget( "ui.popup", {
3939
this._bind(this.options.trigger, {
4040
click: function( event ) {
4141
event.preventDefault();
42+
if (this.open) {
43+
// let it propagate to close
44+
return;
45+
}
4246
var that = this;
4347
setTimeout(function() {
4448
that._open( event );
@@ -47,10 +51,14 @@ $.widget( "ui.popup", {
4751
});
4852

4953
this._bind(this.element, {
50-
blur: "_close"
54+
// TODO also triggered when open and clicking the trigger again
55+
// figure out how to close in that case, while still closing on regular blur
56+
//blur: "_close"
5157
});
5258

5359
this._bind({
60+
// TODO only triggerd on element if it can receive focus
61+
// bind to document instead?
5462
keyup: function( event ) {
5563
if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
5664
this._close( event );

0 commit comments

Comments
 (0)