Skip to content

Commit

Permalink
Added DOMNodeRemovedFromDocument event for when an element is detache…
Browse files Browse the repository at this point in the history
…d and the tooltip is still visible
  • Loading branch information
antoniogiordano committed Feb 15, 2017
1 parent c4a4f87 commit a04f30d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class ReactTooltip extends Component {
target.addEventListener('mousemove', this.updateTooltip, isCaptureMode)
}
target.addEventListener('mouseleave', this.hideTooltip, isCaptureMode)
target.addEventListener('DOMNodeRemovedFromDocument', this.hideTooltip, isCaptureMode)
})

// Global event to hide tooltip
Expand Down Expand Up @@ -219,6 +220,7 @@ class ReactTooltip extends Component {
target.removeEventListener('mouseenter', this.showTooltip, isCaptureMode)
target.removeEventListener('mousemove', this.updateTooltip, isCaptureMode)
target.removeEventListener('mouseleave', this.hideTooltip, isCaptureMode)
target.removeEventListener('DOMNodeRemovedFromDocument', this.hideTooltip, isCaptureMode)
}

/**
Expand Down

0 comments on commit a04f30d

Please sign in to comment.