From 133fba2ad9b588233f7c7303619ac42351f08926 Mon Sep 17 00:00:00 2001 From: Scott González Date: Sun, 29 May 2011 19:21:31 -0400 Subject: Tooltip: Don't close tooltips on mouseleave if the element is still focused. --- ui/jquery.ui.tooltip.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ui/jquery.ui.tooltip.js') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index c5d9508f7..44398a871 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -56,7 +56,8 @@ $.widget( "ui.tooltip", { target = $( event ? event.target : this.element ) .closest( this.options.items ); - if ( !target.length ) { + // if aria-describedby exists, then the tooltip is already open + if ( !target.length || target.attr( "aria-describedby" ) ) { return; } @@ -131,7 +132,9 @@ $.widget( "ui.tooltip", { target.attr( "title", target.data( "tooltip-title" ) ); } - if ( this.options.disabled ) { + // don't close if the element has focus + // this prevents the tooltip from closing if you hover while focused + if ( this.options.disabled || document.activeElement === target[0] ) { return; } -- cgit v1.2.3