From 3e65c9e0b6f05c93db00d721aafe18d7c416aa88 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Mon, 3 Aug 2015 10:56:30 -0700 Subject: [PATCH] fix(tooltip): doesn't show on archive either --- internal_packages/tooltip/lib/tooltip.cjsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal_packages/tooltip/lib/tooltip.cjsx b/internal_packages/tooltip/lib/tooltip.cjsx index e4d63ea8c..598f7e37c 100644 --- a/internal_packages/tooltip/lib/tooltip.cjsx +++ b/internal_packages/tooltip/lib/tooltip.cjsx @@ -88,7 +88,6 @@ class Tooltip extends React.Component _onTooltipLeave: => return unless @_enteredTooltip - @_mutationObserver?.disconnect() @_enteredTooltip = false clearTimeout(@_showTimeout) @_hideTooltip() @@ -117,9 +116,12 @@ class Tooltip extends React.Component top = dim.top - TOOLTIP_HEIGHT # If for some reason the element was removed from underneath us, we - # won't know until we get here. The element's dimensions will return 0 - # ,0, which we can use to filter out bad displays - if left < 5 and top < 5 + # won't know until we get here. The element's dimensions will return + # (0, 14), which we can use to filter out bad displays. This can + # happen if our mutation observer misses the event. In some cases + # (like the multi-select toolbar), the button's great-grandparent is + # removed from the DOM and no mutation observer event is fired. + if left < 20 and top < 20 @_hideTooltip() return @@ -159,6 +161,7 @@ class Tooltip extends React.Component document.body.offsetHeight _hideTooltip: => + @_mutationObserver?.disconnect() @_lastTarget = null @setState top: 0