mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
tweak(tooltip): Fix Sentry 2938
This commit is contained in:
parent
42d397fa76
commit
1d21666382
1 changed files with 6 additions and 4 deletions
|
@ -36,6 +36,7 @@ class Tooltip extends React.Component
|
|||
clearTimeout @_showTimeout
|
||||
clearTimeout @_showDelayTimeout
|
||||
@_mutationObserver?.disconnect()
|
||||
@_enteredTooltip = false
|
||||
|
||||
render: =>
|
||||
<div className="tooltip-wrap #{@state.pos}" style={@_positionStyles()}>
|
||||
|
@ -56,15 +57,16 @@ class Tooltip extends React.Component
|
|||
if elWithTooltip and DOMUtils.nodeIsVisible(elWithTooltip)
|
||||
if elWithTooltip isnt @_lastTarget
|
||||
@_onTooltipEnter(elWithTooltip)
|
||||
else
|
||||
@_hideTooltip() if @state.display
|
||||
else if @state.display
|
||||
@_hideTooltip()
|
||||
|
||||
onMouseOut: (e) =>
|
||||
if @_elementWithTooltip(e.fromElement) and not @_elementWithTooltip(e.toElement)
|
||||
@_onTooltipLeave()
|
||||
|
||||
onMouseDown: (e) =>
|
||||
if @state.display then @_hideTooltip()
|
||||
if @state.display
|
||||
@_hideTooltip()
|
||||
|
||||
_elementWithTooltip: (target) =>
|
||||
while target
|
||||
|
@ -75,7 +77,7 @@ class Tooltip extends React.Component
|
|||
_onTooltipEnter: (target) =>
|
||||
# https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
||||
@_mutationObserver?.disconnect()
|
||||
@_mutationObserver = new MutationObserver @_onTooltipLeave
|
||||
@_mutationObserver = new MutationObserver(@_onTooltipLeave)
|
||||
@_mutationObserver.observe(target.parentNode, attributes: true, subtree: true, childList: true)
|
||||
|
||||
@_lastTarget = target
|
||||
|
|
Loading…
Reference in a new issue