Skip to content

Commit

Permalink
Fixed jumping chevrons in sidebar (attempt)
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Sep 27, 2022
1 parent 978eab0 commit 290de4a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions material/assets/stylesheets/main.4eacb97b.min.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion material/assets/stylesheets/main.e38d1c16.min.css

This file was deleted.

2 changes: 1 addition & 1 deletion material/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.e38d1c16.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.4eacb97b.min.css' | url }}">
{% if config.theme.palette %}
{% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.cbb835fc.min.css' | url }}">
Expand Down
17 changes: 17 additions & 0 deletions src/assets/stylesheets/main/layout/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@
}
}
}

// Sidebar wrapper
&__inner {

// Hack: the scrollbar is only visible when the sidebar's contents overflow,
// which is nice, but leads to the problem where the chevrons of expandable
// sections will jump by `4px` when the sidebar is shown. We wanted to fix
// this problem for so long, but haven't found a clean way of doing it.
// Until now. The following declaration is only applied to Webkit browsers
// (e.g. Chrome and Safari), which support styling of scrollbars. The trick
// is to add conditional padding on the side of the scrollbar only if the
// sidebar's content doesn't overflow. This hack is inspired and adapted
// from Ayke van Laëthem's year old trick – see https://bit.ly/3Sb1qql
@supports selector(::-webkit-scrollbar) {
padding-inline-end: calc(100% - #{px2rem(230px)});
}
}
}

// [tablet -]: Show overlay on active drawer
Expand Down

0 comments on commit 290de4a

Please sign in to comment.