Skip to content

Commit b96126b

Browse files
committed
Popup: Rename _close to close and use it when selecting something within a popup.
1 parent bba4cb2 commit b96126b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

demos/tooltip/video-player.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
});
2525
$(".set").buttonset();
2626

27-
// TODO hide the tooltip when clicking the button
28-
$("ul").menu().popup({
27+
$("ul").menu({
28+
select: function() {
29+
// would also execute some other action here
30+
$(this).popup("close");
31+
}
32+
}).popup({
2933
trigger: $(".menu")
3034
});
3135

tests/visual/menu/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
var selected = {
2626
select: function( event, ui ) {
2727
$( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
28-
$(this).hide();
28+
$(this).popup("close");
2929
}
3030
};
3131

tests/visual/menu/popup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $.widget( "ui.popup", {
3434

3535
this.element
3636
.addClass("ui-popup")
37-
this._close();
37+
this.close();
3838

3939
this._bind(this.options.trigger, {
4040
click: function( event ) {
@@ -53,15 +53,15 @@ $.widget( "ui.popup", {
5353
this._bind(this.element, {
5454
// TODO also triggered when open and clicking the trigger again
5555
// figure out how to close in that case, while still closing on regular blur
56-
//blur: "_close"
56+
//blur: "close"
5757
});
5858

5959
this._bind({
6060
// TODO only triggerd on element if it can receive focus
6161
// bind to document instead?
6262
keyup: function( event ) {
6363
if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
64-
this._close( event );
64+
this.close( event );
6565
this.options.trigger.focus();
6666
}
6767
}
@@ -70,7 +70,7 @@ $.widget( "ui.popup", {
7070
this._bind(document, {
7171
click: function( event ) {
7272
if (this.open && !$(event.target).closest(".ui-popup").length) {
73-
this._close( event );
73+
this.close( event );
7474
}
7575
}
7676
})
@@ -114,7 +114,7 @@ $.widget( "ui.popup", {
114114
this._trigger( "open", event );
115115
},
116116

117-
_close: function( event ) {
117+
close: function( event ) {
118118
this.element
119119
.hide()
120120
.attr( "aria-hidden", true )

0 commit comments

Comments
 (0)