Skip to content

Commit

Permalink
Fix #31 - Tooltip shown when cursor not over node
Browse files Browse the repository at this point in the history
Caused when currentTooltip is null. findAncestor ends up returning null, which equals currentTooltip and prevents the clearTimeout call from properly preventing the tooltip from being shown.
  • Loading branch information
Justin Pealing authored and Justin Pealing committed Jan 22, 2017
1 parent 468df83 commit b3e819a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tooltip.js
Expand Up @@ -48,8 +48,9 @@ function onMouseover(node) {
function onMouseout(node, event) {
// http://stackoverflow.com/questions/4697758/prevent-onmouseout-when-hovering-child-element-of-the-parent-absolute-div-withou
var e = event.toElement || event.relatedTarget;
if (e == node || findAncestor(e, 'qp-node') == node ||
e == currentTooltip || findAncestor(e, 'qp-tt') == currentTooltip) {
if (e == node ||
findAncestor(e, 'qp-node') == node ||
(currentTooltip != null && (e == currentTooltip || findAncestor(e, 'qp-tt') == currentTooltip))) {
return;
}
window.clearTimeout(timeoutId);
Expand Down

0 comments on commit b3e819a

Please sign in to comment.