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

Commit 7855976

Browse files
Johnnyrook777wesleycho
authored andcommitted
fix(tooltip): cancel timeout when hidden
- Cancel timeout when hidden so that positioning does not incorrectly occur when not visible Closes #6226 Fixes #6221
1 parent 14384fc commit 7855976

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/tooltip/tooltip.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
144144
var showTimeout;
145145
var hideTimeout;
146146
var positionTimeout;
147+
var adjustmentTimeout;
147148
var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false;
148149
var triggers = getTriggers(undefined);
149150
var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']);
@@ -176,12 +177,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
176177
tooltip.addClass(options.placementClassPrefix + ttPosition.placement);
177178
}
178179

179-
$timeout(function() {
180+
adjustmentTimeout = $timeout(function() {
180181
var currentHeight = angular.isDefined(tooltip.offsetHeight) ? tooltip.offsetHeight : tooltip.prop('offsetHeight');
181182
var adjustment = $position.adjustTop(placementClasses, elementPos, initialHeight, currentHeight);
182183
if (adjustment) {
183184
tooltip.css(adjustment);
184185
}
186+
adjustmentTimeout = null;
185187
}, 0, false);
186188

187189
// first time through tt element will have the
@@ -346,7 +348,11 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
346348

347349
if (tooltip) {
348350
tooltip.remove();
351+
349352
tooltip = null;
353+
if (adjustmentTimeout) {
354+
$timeout.cancel(adjustmentTimeout);
355+
}
350356
}
351357

352358
openedTooltips.remove(ttScope);

0 commit comments

Comments
 (0)