Skip to content

Commit f5ab2c7

Browse files
committed
fix(tooltip): tooltip appears on wrong position by a fraction of a second
- Avoid position computation when tooltip is empty - Force visibility to none when resetting style Fixes: angular-ui#4195
1 parent 1e039e8 commit f5ab2c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tooltip/tooltip.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position'])
132132
var isOpenExp = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false;
133133

134134
var positionTooltip = function() {
135-
if (!tooltip) { return; }
135+
// check if tooltip exists and is not empty
136+
if (!tooltip || !tooltip.html()) { return; }
136137

137138
if (!positionTimeout) {
138139
positionTimeout = $timeout(function() {
139140
// Reset the positioning and box size for correct width and height values.
140-
tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto' });
141+
tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto', visibility: 'none' });
141142

142143
var ttBox = $position.position(tooltip);
143144
var ttCss = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);

0 commit comments

Comments
 (0)