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

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 #4363
Fixes #4195
  • Loading branch information
dabos-GFI authored and wesleycho committed Sep 7, 2015
1 parent 72de2d8 commit 8fee75d
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' });

This comment has been minimized.

Copy link
@RobJacobs

RobJacobs Sep 8, 2015

Contributor

@wesleycho @dabos-GFI Removing the display: 'block' on the tooltip css breaks the popover implementation. Bootstrap starts with a display: none on the popover style. Proposed fix would be to add display: block to the style attribute added on the template.

This comment has been minimized.

Copy link
@wesleycho

wesleycho Sep 8, 2015

Contributor

Did not know this - can you investigate what else is needed so it works well for both?

This comment has been minimized.

Copy link
@RobJacobs

RobJacobs Sep 8, 2015

Contributor

tooltip and popover styles both end up with display: block, so my proposed fix should be all that's needed. I will submit a PR shortly.


positionTooltip();
}

Expand Down

0 comments on commit 8fee75d

Please sign in to comment.