mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tooltip: Handle ESCAPE key event to close tooltip when target has focus.
This commit is contained in:
parent
bc93b3ff08
commit
2803417dc4
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 } );
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user