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

Commit 8fee75d

Browse files
dabos-GFIwesleycho
authored andcommitted
fix(tooltip): correct flash of reposition
- Avoid position computation when tooltip is empty - Force visibility to none when resetting style Closes #4363 Fixes #4195
1 parent 72de2d8 commit 8fee75d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tooltip/tooltip.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position'])
110110
'animation="animation" '+
111111
'is-open="isOpen"'+
112112
'origin-scope="origScope" '+
113+
'style="visibility: hidden"'+
113114
'>'+
114115
'</div>';
115116

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

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

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

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

230-
tooltip.css({ display: 'block', visibility: 'hidden' });
231-
232232
positionTooltip();
233233
}
234234

0 commit comments

Comments
 (0)