Skip to content

Commit ab55e6b

Browse files
fix: helper function that determines the ion-menu animation side now takes parent element direction attribute into consideration
1 parent 2ecb0a5 commit ab55e6b

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

core/src/components/menu/menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ export class Menu implements ComponentInterface, MenuI {
499499
* Menu direction animation is calculated based on the document direction.
500500
* If the document direction changes, we need to create a new animation.
501501
*/
502-
const isEndSide = isEnd(this.side);
502+
const isEndSide = isEnd(this.side, this.el);
503503
if (width === this.width && this.animation !== undefined && isEndSide === this.isEndSide) {
504504
return;
505505
}

core/src/utils/helpers.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,15 @@ export const pointerCoord = (ev: any): { x: number; y: number } => {
319319
* Given a side, return if it should be on the end
320320
* based on the value of dir
321321
* @param side the side
322+
* @param hostElement the host element
322323
* @param isRTL whether the application dir is rtl
323324
*/
324-
export const isEndSide = (side: Side): boolean => {
325-
const isRTL = document.dir === 'rtl';
325+
export const isEndSide = (side: Side, hostElement?: Element): boolean => {
326+
const isRTL = hostElement
327+
? hostElement.closest('[dir]')?.getAttribute('dir') === 'rtl'
328+
: document.dir === 'rtl'
329+
;
330+
326331
switch (side) {
327332
case 'start':
328333
return isRTL;

0 commit comments

Comments
 (0)