From 212ff8db37a0cb4fa283bfc94e0b44191e2d4566 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Aug 2016 17:10:55 +0200 Subject: [PATCH] Fixed tooltip flicker --- .../WoltLabSuite/Core/Ui/Redactor/PseudoHeader.js | 2 +- .../files/js/WoltLabSuite/Core/Ui/Tooltip.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/PseudoHeader.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/PseudoHeader.js index c60a5e2fe3..3cf57f472e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/PseudoHeader.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/PseudoHeader.js @@ -30,7 +30,7 @@ define([], function() { var titleHeight = ~~styles.height.replace(/px$/, ''); if (titleHeight === 0) { // firefox returns garbage for pseudo element height - // https://bugzilla.mozilla.org/show_bug.cgi?id=925694#c7 + // https://bugzilla.mozilla.org/show_bug.cgi?id=925694 titleHeight = element.scrollHeight; element.classList.add('redactorCalcHeight'); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Tooltip.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Tooltip.js index 625779e49c..bfc51d5bfb 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Tooltip.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Tooltip.js @@ -27,6 +27,14 @@ define(['Environment', 'Dom/ChangeListener', 'Ui/Alignment'], function(Environme _tooltip = elCreate('div'); elAttr(_tooltip, 'id', 'balloonTooltip'); _tooltip.classList.add('balloonTooltip'); + _tooltip.addEventListener('transitionend', function () { + if (!_tooltip.classList.contains('active')) { + // reset back to the upper left corner, prevent it from staying outside + // the viewport if the body overflow was previously hidden + _tooltip.style.removeProperty('top'); + _tooltip.style.removeProperty('left'); + } + }); _text = elCreate('span'); elAttr(_text, 'id', 'balloonTooltipText'); @@ -114,11 +122,6 @@ define(['Environment', 'Dom/ChangeListener', 'Ui/Alignment'], function(Environme */ _mouseLeave: function() { _tooltip.classList.remove('active'); - - // reset back to the upper left corner, prevent it from staying outside - // the viewport if the body overflow was previously hidden - _tooltip.style.removeProperty('top'); - _tooltip.style.removeProperty('left'); } }; }); -- 2.20.1