Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL improvements #32436

Merged
merged 4 commits into from Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 21 additions & 4 deletions js/src/carousel.js
Expand Up @@ -11,6 +11,7 @@ import {
getElementFromSelector,
getTransitionDurationFromElement,
isVisible,
isRTL,
reflow,
triggerTransitionEnd,
typeCheckConfig
Expand Down Expand Up @@ -250,12 +251,20 @@ class Carousel extends BaseComponent {

// swipe left
if (direction > 0) {
this.prev()
if (isRTL) {
this.next()
} else {
this.prev()
}
}

// swipe right
if (direction < 0) {
this.next()
if (isRTL) {
this.prev()
} else {
this.next()
}
}
}

Expand Down Expand Up @@ -339,10 +348,18 @@ class Carousel extends BaseComponent {

if (event.key === ARROW_LEFT_KEY) {
event.preventDefault()
this.prev()
if (isRTL) {
this.next()
} else {
this.prev()
}
} else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault()
this.next()
if (isRTL) {
this.prev()
} else {
this.next()
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions site/content/docs/5.0/examples/cheatsheet/cheatsheet.css
Expand Up @@ -63,6 +63,10 @@ body {
line-height: 0;
content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
transition: transform .35s ease;

/* rtl:raw:
transform: rotate(180deg) translateX(-2px);
*/
transform-origin: .5em 50%;
}

Expand Down
Expand Up @@ -63,6 +63,7 @@ body {
line-height: 0;
content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
transition: transform .35s ease;
transform: rotate(180deg) translateX(-2px);
transform-origin: .5em 50%;
}

Expand Down