diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-07-13 18:06:16 -0400 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-07-13 18:06:16 -0400 |
commit | 2803417dc44c6147cee14f46ba0ccfa29218a257 (patch) | |
tree | b4c52f5dd32fbd31986d5a895abc7ab78a311c1a /ui | |
parent | bc93b3ff080160e4e8e7a035e2e4421d1521e224 (diff) | |
download | jquery-ui-2803417dc44c6147cee14f46ba0ccfa29218a257.tar.gz jquery-ui-2803417dc44c6147cee14f46ba0ccfa29218a257.zip |
Tooltip: Handle ESCAPE key event to close tooltip when target has focus.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index f19061bc3..5e32459fc 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -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 } ); }, |