Skip to content

Commit

Permalink
feat(chore): same custom scrollbars in chrome, FF and IE
Browse files Browse the repository at this point in the history
Custom scrollbars are already implemented since a long time for non body elements.
However, only webit based browsers were targeted.

This PR now adds the same look and feel to firefox and IE as well (as far, as those browsers support it)
  • Loading branch information
lubber-de authored Sep 9, 2021
1 parent af220e9 commit 97d7039
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 19 deletions.
25 changes: 23 additions & 2 deletions src/definitions/globals/site.less
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ a:hover {
Scrollbars
*******************************/

.addScrollbars() when (@useCustomScrollbars) {
& when (@useCustomScrollbars) {

/* Force Simple Scrollbars */
body ::-webkit-scrollbar {
Expand All @@ -152,6 +152,17 @@ a:hover {
body ::-webkit-scrollbar-thumb:hover {
background: @thumbHoverBackground;
}
body .ui {
/* IE11 */
scrollbar-face-color: @thumbBackgroundHex;
scrollbar-shadow-color: @thumbBackgroundHex;
scrollbar-track-color: @trackBackgroundHex;
scrollbar-arrow-color: @trackBackgroundHex;

/* firefox : first color thumb, second track*/
scrollbar-color: @thumbBackground @trackBackground;
scrollbar-width: thin;
}

/* Inverted UI */
body .ui.inverted:not(.dimmer)::-webkit-scrollbar-track {
Expand All @@ -166,6 +177,17 @@ a:hover {
body .ui.inverted:not(.dimmer)::-webkit-scrollbar-thumb:hover {
background: @thumbInvertedHoverBackground;
}

body .ui.inverted:not(.dimmer) {
/* IE11 */
scrollbar-face-color: @thumbInvertedBackgroundHex;
scrollbar-shadow-color: @thumbInvertedBackgroundHex;
scrollbar-track-color: @trackInvertedBackgroundHex;
scrollbar-arrow-color: @trackInvertedBackgroundHex;

/* firefox : first color thumb, second track */
scrollbar-color: @thumbInvertedBackground @trackInvertedBackground;
}
}

/*******************************
Expand Down Expand Up @@ -203,5 +225,4 @@ input::selection {
color: @inputHighlightColor;
}

.addScrollbars();
.loadUIOverrides();
13 changes: 11 additions & 2 deletions src/definitions/modules/dimmer.less
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}

/* Scrollbars */
.addScrollbars() when (@useCustomScrollbars) {
& when (@useCustomScrollbars) {
.ui.dimmer:not(.inverted)::-webkit-scrollbar-track {
background: @trackInvertedBackground;
}
Expand All @@ -81,8 +81,17 @@
.ui.dimmer:not(.inverted)::-webkit-scrollbar-thumb:hover {
background: @thumbInvertedHoverBackground;
}
.ui.dimmer:not(.inverted) {
/* IE11 */
scrollbar-face-color: @thumbInvertedBackgroundHex;
scrollbar-shadow-color: @thumbInvertedBackgroundHex;
scrollbar-track-color: @trackInvertedBackgroundHex;
scrollbar-arrow-color: @trackInvertedBackgroundHex;

/* firefox : first color thumb, second track */
scrollbar-color: @thumbInvertedBackground @trackInvertedBackground;
}
}
.addScrollbars();

/*******************************
States
Expand Down
43 changes: 28 additions & 15 deletions src/definitions/modules/dropdown.less
Original file line number Diff line number Diff line change
Expand Up @@ -1912,21 +1912,34 @@ select.ui.dropdown {
}

/* Scrollbars */
.ui.dropdown .inverted.menu::-webkit-scrollbar-track,
.ui.inverted.dropdown .menu::-webkit-scrollbar-track {
background: @trackInvertedBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb {
background: @thumbInvertedBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:window-inactive,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:window-inactive {
background: @thumbInvertedInactiveBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:hover,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:hover {
background: @thumbInvertedHoverBackground;
& when (@useCustomScrollbars) {
.ui.dropdown .inverted.menu::-webkit-scrollbar-track,
.ui.inverted.dropdown .menu::-webkit-scrollbar-track {
background: @trackInvertedBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb {
background: @thumbInvertedBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:window-inactive,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:window-inactive {
background: @thumbInvertedInactiveBackground;
}
.ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:hover,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:hover {
background: @thumbInvertedHoverBackground;
}
.ui.dropdown .inverted.menu,
.ui.inverted.dropdown .menu {
/* IE11 */
scrollbar-face-color: @thumbInvertedBackgroundHex;
scrollbar-shadow-color: @thumbInvertedBackgroundHex;
scrollbar-track-color: @trackInvertedBackgroundHex;
scrollbar-arrow-color: @trackInvertedBackgroundHex;

/* firefox : first color thumb, second track */
scrollbar-color: @thumbInvertedBackground @trackInvertedBackground;
}
}
& when (@variationDropdownPointing) {
.ui.pointing.dropdown > .inverted.menu:after,
Expand Down
6 changes: 6 additions & 0 deletions src/themes/default/globals/site.variables
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
@thumbInvertedInactiveBackground: rgba(255, 255, 255, 0.15);
@thumbInvertedHoverBackground: rgba(255, 255, 255, 0.35);

/* IE needs hex values */
@trackBackgroundHex: #e6e6e6;
@thumbBackgroundHex: #bfbfbf;
@trackInvertedBackgroundHex: #323232;
@thumbInvertedBackgroundHex: #656565;

/*-------------------
Highlighted Text
--------------------*/
Expand Down

0 comments on commit 97d7039

Please sign in to comment.