aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-06-14 10:06:21 -0400
committerScott González <scott.gonzalez@gmail.com>2012-06-14 12:40:03 -0400
commitd740e450aa7bd8a4f254f0268d74636d5920c60a (patch)
tree093ce0ac9a08f766d5ca8ab1659abc3e109645ff /ui
parent5c2cf39dff34b4598b214b1a2a1f3b48d15f0366 (diff)
downloadjquery-ui-d740e450aa7bd8a4f254f0268d74636d5920c60a.tar.gz
jquery-ui-d740e450aa7bd8a4f254f0268d74636d5920c60a.zip
Tooltip: Reposition tracking tooltips when they gain focus.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.tooltip.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 2c80f328c..5ef5051af 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -118,8 +118,18 @@ $.widget( "ui.tooltip", {
target = $( event ? event.target : this.element )
.closest( this.options.items );
- // if ui-tooltip-id exists, then the tooltip is already open
- if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+ // No element to show a tooltip for
+ if ( !target.length ) {
+ return;
+ }
+
+ // If the tooltip is open and we're tracking then reposition the tooltip.
+ // This makes sure that a tracking tooltip doesn't obscure a focused element
+ // if the user was hovering when the element gained focused.
+ if ( this.options.track && target.data( "ui-tooltip-id" ) ) {
+ this._find( target ).position( $.extend({
+ of: target
+ }, this.options.position ) );
return;
}
@@ -250,9 +260,7 @@ $.widget( "ui.tooltip", {
target.removeData( "tooltip-open" );
this._off( target, "mouseleave focusout keyup" );
-
- // TODO use _off
- this.document.unbind( "mousemove.tooltip" );
+ this._off( this.document, "mousemove" );
this.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );