Skip to content
Permalink
Browse files

fix(popover): update animation origin in RTL/MD (#17645)

Original main-axis origin fix was flawed in case of RTL.
Invert the animation’s main-axis origin in case the popover’s position is adjusted.

references #17012
  • Loading branch information...
abennouna authored and brandyscarney committed Mar 15, 2019
1 parent 9c48fa7 commit 617453ba439a7dc1f7d278fa82a0b79498ef14e2
Showing with 8 additions and 1 deletion.
  1. +8 −1 core/src/components/popover/animations/md.enter.ts
@@ -47,12 +47,19 @@ export function mdEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev?
// exceeds the body width it is off screen to the right so adjust
if (popoverCSS.left < POPOVER_MD_BODY_PADDING) {
popoverCSS.left = POPOVER_MD_BODY_PADDING;

// Same origin in this case for both LTR & RTL
// Note: in LTR, originX is already 'left'
originX = 'left';
} else if (
contentWidth + POPOVER_MD_BODY_PADDING + popoverCSS.left >
bodyWidth
) {
popoverCSS.left = bodyWidth - contentWidth - POPOVER_MD_BODY_PADDING;
originX = isRTL ? 'left' : 'right';

// Same origin in this case for both LTR & RTL
// Note: in RTL, originX is already 'right'
originX = 'right';
}

// If the popover when popped down stretches past bottom of screen,

0 comments on commit 617453b

Please sign in to comment.
You can’t perform that action at this time.