Skip to content

Commit

Permalink
Tooltip: Only check if the element is active if the event that is cau…
Browse files Browse the repository at this point in the history
…sing the tooltip to close is not focusout.
  • Loading branch information
scottgonzalez committed Apr 30, 2012
1 parent b8b0c52 commit dbf31da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/jquery.ui.tooltip.js
Expand Up @@ -179,7 +179,10 @@ $.widget( "ui.tooltip", {

// don't close if the element has focus
// this prevents the tooltip from closing if you hover while focused
if ( !force && this.document[0].activeElement === target[0] ) {
// we have to check the event type because tabbing out of the document
// may leave the element as the activeElement
if ( !force && event && event.type !== "focusout" &&
this.document[0].activeElement === target[0] ) {
return;
}

Expand Down

1 comment on commit dbf31da

@jzaefferer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Will keep that in mind next time we use document.activeElement somewhere.

Please sign in to comment.