diff --git a/packages/main/src/Carousel.hbs b/packages/main/src/Carousel.hbs index 593afa9d0b57..984af771eeb2 100644 --- a/packages/main/src/Carousel.hbs +++ b/packages/main/src/Carousel.hbs @@ -23,36 +23,15 @@ {{#if arrows.content}} {{/if}} {{#if showNavigationArrows}}
{{#if arrows.navigation}} - + {{> arrow-back}} {{/if}} {{#if arrows.navigation}} - + {{> arrow-forward}} {{/if}}
{{/if}} - \ No newline at end of file + + +{{#*inline "arrow-back"}} + +{{/inline}} + +{{#*inline "arrow-forward"}} + +{{/inline}} \ No newline at end of file diff --git a/packages/main/src/Carousel.js b/packages/main/src/Carousel.js index c22197e523b1..606b6a659cfd 100644 --- a/packages/main/src/Carousel.js +++ b/packages/main/src/Carousel.js @@ -411,7 +411,7 @@ class Carousel extends UI5Element { get styles() { return { content: { - transform: `translateX(-${this.selectedIndex * this._itemWidth}px`, + transform: `translateX(${this._isRTL ? "" : "-"}${this.selectedIndex * this._itemWidth}px`, }, }; } @@ -484,8 +484,12 @@ class Carousel extends UI5Element { return this._resizing || getAnimationMode() === AnimationMode.None; } + get _isRTL() { + return this.effectiveDir === "rtl"; + } + get selectedIndexToShow() { - return this.selectedIndex + 1; + return this._isRTL ? this.pagesCount - (this.pagesCount - this.selectedIndex) + 1 : this.selectedIndex + 1; } get showNavigationArrows() {