Skip to content

Commit 4c8620c

Browse files
committed
Added support for scrollbar-gutter
1 parent 290de4a commit 4c8620c

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

Diff for: material/assets/stylesheets/main.4eacb97b.min.css

-1
This file was deleted.

Diff for: material/assets/stylesheets/main.80dcb947.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: material/assets/stylesheets/main.4eacb97b.min.css.map renamed to material/assets/stylesheets/main.80dcb947.min.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: material/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{% endif %}
3535
{% endblock %}
3636
{% block styles %}
37-
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.4eacb97b.min.css' | url }}">
37+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.80dcb947.min.css' | url }}">
3838
{% if config.theme.palette %}
3939
{% set palette = config.theme.palette %}
4040
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.cbb835fc.min.css' | url }}">

Diff for: src/assets/stylesheets/main/layout/_sidebar.scss

+19-13
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
// this reason, we disable scroll snapping until this is resolved (#1667).
131131
// scroll-snap-type: y mandatory;
132132
scrollbar-width: thin;
133+
scrollbar-gutter: stable;
133134
scrollbar-color: var(--md-default-fg-color--lighter) transparent;
134135

135136
// Sidebar scroll wrapper on hover
@@ -154,19 +155,24 @@
154155
}
155156
}
156157

157-
// Sidebar wrapper
158-
&__inner {
159-
160-
// Hack: the scrollbar is only visible when the sidebar's contents overflow,
161-
// which is nice, but leads to the problem where the chevrons of expandable
162-
// sections will jump by `4px` when the sidebar is shown. We wanted to fix
163-
// this problem for so long, but haven't found a clean way of doing it.
164-
// Until now. The following declaration is only applied to Webkit browsers
165-
// (e.g. Chrome and Safari), which support styling of scrollbars. The trick
166-
// is to add conditional padding on the side of the scrollbar only if the
167-
// sidebar's content doesn't overflow. This hack is inspired and adapted
168-
// from Ayke van Laëthem's year old trick – see https://bit.ly/3Sb1qql
169-
@supports selector(::-webkit-scrollbar) {
158+
// Hack: the scrollbar is only visible when the sidebar's contents overflow,
159+
// which is nice, but leads to the problem where the chevrons of expandable
160+
// sections will jump by `4px` when the sidebar is shown. We wanted to fix
161+
// this problem for so long, but haven't found a clean way of doing it.
162+
// Until now. The following declaration is only applied to Webkit browsers
163+
// (e.g. Chrome and Safari), which support styling of scrollbars. The trick
164+
// is to add conditional padding on the side of the scrollbar only if the
165+
// sidebar's content doesn't overflow. This hack is inspired and adapted
166+
// from Ayke van Laëthem's year old trick – see https://bit.ly/3Sb1qql
167+
@supports selector(::-webkit-scrollbar) {
168+
169+
// Sidebar scroll wrapper
170+
&__scrollwrap {
171+
scrollbar-gutter: auto;
172+
}
173+
174+
// Sidebar wrapper
175+
&__inner {
170176
padding-inline-end: calc(100% - #{px2rem(230px)});
171177
}
172178
}

0 commit comments

Comments
 (0)