mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Tooltip: Handle ESCAPE key event to close tooltip when target has focus.
This commit is contained in:
11
ui/jquery.ui.tooltip.js
vendored
11
ui/jquery.ui.tooltip.js
vendored
@@ -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 } );
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user