Skip to content
Permalink
Browse files

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

  • Loading branch information...
jzaefferer committed Jul 13, 2011
1 parent bc93b3f commit 2803417dc44c6147cee14f46ba0ccfa29218a257
Showing with 9 additions and 2 deletions.
  1. +9 −2 ui/jquery.ui.tooltip.js
@@ -148,7 +148,14 @@ $.widget( "ui.tooltip", {

this._bind( target, {
mouseleave: "close",
blur: "close"
blur: "close",

This comment has been minimized.

Copy link
@gnarf

gnarf Feb 23, 2012

Member

This is probably unrelated to the commit - but it was the blame for this line...

I'm pretty sure this should be focusout instead of blur - take a look at this fiddle: http://jsfiddle.net/pm4JG/1/

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 } );
},

0 comments on commit 2803417

Please sign in to comment.
You can’t perform that action at this time.