From 6b7f45b09cbe80017355f83e4e33ecf392e4e6a6 Mon Sep 17 00:00:00 2001 From: Oliver Salzburg Date: Mon, 22 Jan 2018 20:40:25 +0100 Subject: [PATCH] fix(tooltip): changing direction causes invalid position Providing the initial origin through the `panelClass` of the panel is not the right approach. `mdPanel` remembers the original panel configuration and the provided `panelClass` and will restore it when the element is reused. This results in the new origin and the default (bottom) origin style to be placed on the element. Fixes #10405 --- src/components/tooltip/tooltip.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/tooltip/tooltip.js b/src/components/tooltip/tooltip.js index c69201ee5e..20052bc454 100644 --- a/src/components/tooltip/tooltip.js +++ b/src/components/tooltip/tooltip.js @@ -387,11 +387,14 @@ function MdTooltipDirective($timeout, $window, $$rAF, $document, $interpolate, attachTo: attachTo, contentElement: element, propagateContainerEvents: true, - panelClass: 'md-tooltip ' + origin, + panelClass: 'md-tooltip', animation: panelAnimation, position: panelPosition, zIndex: scope.mdZIndex, - focusOnOpen: false + focusOnOpen: false, + onDomAdded: function() { + panelRef.panelEl.addClass(origin); + } }; panelRef = $mdPanel.create(panelConfig);