Skip to content

Commit

Permalink
fix(tooltip): correct flash of reposition
Browse files Browse the repository at this point in the history
- Avoid position computation when tooltip is empty
- Force visibility to none when resetting style

Closes angular-ui#4363
Fixes angular-ui#4195
  • Loading branch information
dabos-GFI authored and jasonaden committed Sep 30, 2015
1 parent 220a3fc commit a532522
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit a532522

Please sign in to comment.