Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

fix(tooltip): tooltip appears on wrong position by a fraction of a second #4363

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position'])
'animation="animation" '+
'is-open="isOpen"'+
'origin-scope="origScope" '+
'style="visibility: hidden"'+
'>'+
'</div>';

Expand All @@ -132,12 +133,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position'])
var isOpenExp = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false;

var positionTooltip = function() {
if (!tooltip) { return; }
// check if tooltip exists and is not empty
if (!tooltip || !tooltip.html()) { return; }

if (!positionTimeout) {
positionTimeout = $timeout(function() {
// Reset the positioning and box size for correct width and height values.
tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto' });
tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto', visibility: 'hidden' });

var ttBox = $position.position(tooltip);
var ttCss = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
Expand Down Expand Up @@ -227,8 +229,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position'])
ttScope.$apply(); // digest required as $apply is not called
}

tooltip.css({ display: 'block', visibility: 'hidden' });

positionTooltip();
}

Expand Down