Skip to content

Commit 3a99899

Browse files
crawfxrdehuss
authored andcommitted
Use CSS selectors to override properties for RTL
Fix behavior of some elements when displaying page in RTL. Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
1 parent 1088066 commit 3a99899

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/theme/css/chrome.css

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,20 @@ a > .hljs {
173173
background-color: var(--sidebar-bg);
174174
}
175175

176-
.previous {
177-
/* Only Firefox supports flow-relative values */
178-
float: left;
179-
}
176+
/* Only Firefox supports flow-relative values */
177+
.previous { float: left; }
178+
[dir=rtl] .previous { float: right; }
180179

180+
/* Only Firefox supports flow-relative values */
181181
.next {
182-
/* Only Firefox supports flow-relative values */
183182
float: right;
184183
right: var(--page-padding);
185184
}
185+
[dir=rtl] .next {
186+
float: left;
187+
right: unset;
188+
left: var(--page-padding);
189+
}
186190

187191
@media only screen and (max-width: 1080px) {
188192
.nav-wide-wrapper { display: none; }
@@ -387,6 +391,7 @@ ul#searchresults span.teaser em {
387391
background-color: var(--sidebar-bg);
388392
color: var(--sidebar-fg);
389393
}
394+
[dir=rtl] .sidebar { left: unset; right: 0; }
390395
.sidebar-resizing {
391396
-moz-user-select: none;
392397
-webkit-user-select: none;
@@ -417,6 +422,7 @@ ul#searchresults span.teaser em {
417422
top: 0;
418423
bottom: 0;
419424
}
425+
[dir=rtl] .sidebar .sidebar-resize-handle { right: unset; left: 0; }
420426
.js .sidebar .sidebar-resize-handle {
421427
cursor: col-resize;
422428
width: 5px;
@@ -426,6 +432,9 @@ ul#searchresults span.teaser em {
426432
transform: translateX(calc(0px - var(--sidebar-width)));
427433
z-index: -1;
428434
}
435+
[dir=rtl] .sidebar-hidden .sidebar {
436+
transform: translateX(var(--sidebar-width));
437+
}
429438
.sidebar::-webkit-scrollbar {
430439
background: var(--sidebar-bg);
431440
}
@@ -539,6 +548,7 @@ ul#searchresults span.teaser em {
539548
/* Don't let the children's background extend past the rounded corners. */
540549
overflow: hidden;
541550
}
551+
[dir=rtl] .theme-popup { left: unset; right: 10px; }
542552
.theme-popup .default {
543553
color: var(--icons);
544554
}

src/theme/css/general.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ h6:target::before {
9191
.js:not(.sidebar-resizing) .page-wrapper {
9292
transition: margin-left 0.3s ease, transform 0.3s ease; /* Animation: slide away */
9393
}
94+
[dir=rtl] .js:not(.sidebar-resizing) .page-wrapper {
95+
transition: margin-right 0.3s ease, transform 0.3s ease; /* Animation: slide away */
96+
}
9497

9598
.content {
9699
overflow-y: auto;

0 commit comments

Comments
 (0)