Tooltip: Handle ESCAPE key event to close tooltip when target has focus.

This commit is contained in:
Jörn Zaefferer 2011-07-13 18:06:16 -04:00
parent bc93b3ff08
commit 2803417dc4

View File

@ -148,7 +148,14 @@ $.widget( "ui.tooltip", {
this._bind( target, {
mouseleave: "close",
blur: "close"
blur: "close",
keyup: function( event ) {
if ( event.keyCode == $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
fakeEvent.currentTarget = target[0];
this.close( fakeEvent, true );
}
}
});
},
@ -176,7 +183,7 @@ $.widget( "ui.tooltip", {
delete that.tooltips[ this.id ];
});
target.unbind( "mouseleave.tooltip blur.tooltip" );
target.unbind( "mouseleave.tooltip blur.tooltip keyup.tooltip" );
this._trigger( "close", event, { tooltip: tooltip } );
},