Skip to content

Commit

Permalink
fix(popover): update animation origin in RTL/MD (#17645)
Browse files Browse the repository at this point in the history
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 617453b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/components/popover/animations/md.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 617453b

Please sign in to comment.