Skip to content

Commit 477dc08

Browse files
committed
Replace dir-dependent border-rules with logical properties
*Please note:* This is the final step in a series of patches to simplify/modernize the viewer CSS, since the remaining `html[dir="rtl"]`-cases cannot be converted. Rather than having to manually specify ltr/rtl-specific border-values in the CSS, we can use logical `border-inline-end`/`border-start-end-radius`/`border-end-end-radius` instead. These logical properties depend on, among other things, the direction of the HTML document which we *always* specify in the viewer. Given that most of these logical CSS properties are fairly new, and that cross-browser support is thus somewhat limited (see below), we rely on the previously added PostCSS plugins in order to support this in the GENERIC viewer. - https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-end#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/border-start-end-radius#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/border-end-end-radius#browser_compatibility
1 parent feea2b7 commit 477dc08

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

web/viewer.css

+6-25
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,11 @@ select {
240240
visibility: hidden;
241241
z-index: 100;
242242
border-top: 1px solid rgba(51, 51, 51, 1);
243+
border-inline-end: var(--doorhanger-border-color-whcm);
243244
transition-property: inset-inline-start;
244245
transition-duration: var(--sidebar-transition-duration);
245246
transition-timing-function: var(--sidebar-transition-timing-function);
246247
}
247-
html[dir="ltr"] #sidebarContainer {
248-
border-right: var(--doorhanger-border-color-whcm);
249-
}
250-
html[dir="rtl"] #sidebarContainer {
251-
border-left: var(--doorhanger-border-color-whcm);
252-
}
253248

254249
#outerContainer.sidebarResizing #sidebarContainer {
255250
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
@@ -484,16 +479,9 @@ html[dir="rtl"] #toolbarSidebar {
484479

485480
.findbar .splitToolbarButton > .findNext {
486481
width: 29px;
487-
}
488-
html[dir="ltr"] .findbar .splitToolbarButton > .findNext {
489-
border-bottom-right-radius: 2px;
490-
border-top-right-radius: 2px;
491-
border-right: 1px solid var(--field-border-color);
492-
}
493-
html[dir="rtl"] .findbar .splitToolbarButton > .findNext {
494-
border-bottom-left-radius: 2px;
495-
border-top-left-radius: 2px;
496-
border-left: 1px solid var(--field-border-color);
482+
border-start-end-radius: 2px;
483+
border-end-end-radius: 2px;
484+
border-inline-end: 1px solid var(--field-border-color);
497485
}
498486

499487
.findbar input[type="checkbox"] {
@@ -510,22 +498,15 @@ html[dir="rtl"] .findbar .splitToolbarButton > .findNext {
510498
background-color: var(--button-hover-color);
511499
}
512500

513-
html[dir="ltr"] #findInput {
514-
border-top-right-radius: 0;
515-
border-bottom-right-radius: 0;
516-
}
517-
html[dir="rtl"] #findInput {
518-
border-top-left-radius: 0;
519-
border-bottom-left-radius: 0;
520-
}
521-
522501
.findbar .toolbarField[type="checkbox"]:checked + .toolbarLabel {
523502
background-color: var(--toggled-btn-bg-color) !important;
524503
color: var(--toggled-btn-color);
525504
}
526505

527506
#findInput {
528507
width: 200px;
508+
border-start-end-radius: 0;
509+
border-end-end-radius: 0;
529510
}
530511
#findInput::-webkit-input-placeholder {
531512
color: rgba(191, 191, 191, 1);

0 commit comments

Comments
 (0)