Skip to content

Commit 290de4a

Browse files
committed
Fixed jumping chevrons in sidebar (attempt)
1 parent 978eab0 commit 290de4a

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

material/assets/stylesheets/main.4eacb97b.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/stylesheets/main.e38d1c16.min.css.map renamed to material/assets/stylesheets/main.4eacb97b.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/stylesheets/main.e38d1c16.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

material/base.html

Lines changed: 1 addition & 1 deletion
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.e38d1c16.min.css' | url }}">
37+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.4eacb97b.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 }}">

src/assets/stylesheets/main/layout/_sidebar.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,23 @@
153153
}
154154
}
155155
}
156+
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) {
170+
padding-inline-end: calc(100% - #{px2rem(230px)});
171+
}
172+
}
156173
}
157174

158175
// [tablet -]: Show overlay on active drawer

0 commit comments

Comments
 (0)