Skip to content

Commit 22cb001

Browse files
committed
Fix scroll bug on firefox
1 parent 45e7d6b commit 22cb001

File tree

2 files changed

+50
-38
lines changed

2 files changed

+50
-38
lines changed

_includes/sidebar.html

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@
66
<a href="{{ "/" | relative_url }}">Liquid</a>
77
{% endif %}
88
</header>
9-
<nav class="sidebar__nav"> {% assign sections = "basics, tags, filters" | split: ", " %}
109

11-
{% for section in sections %}
12-
<h3 class="section__header">{{ section | capitalize }}</h3>
10+
{%- assign sections = "basics, tags, filters" | split: ", " -%}
1311

14-
<ul class="section__links">
15-
{% for item in site.pages %}{% if item.url contains section/ %}{% unless item.path contains "index" %}
16-
<li><a href="{{ item.url | relative_url }}" class="section__link{% if item.url contains page.url and page.url != '/' and page.type != 'index' %} section__link--is-active{% endif %}">{{ item.title }}</a></li>
17-
{% endunless %}{% endif %}{% endfor %}
18-
</ul>
19-
{% endfor %}
12+
<nav class="sidebar__nav">
13+
<div class="sidebar__nav-interior">
14+
{%- for section in sections -%}
15+
<h3 class="section__header">{{ section | capitalize }}</h3>
2016

17+
<ul class="section__links">
18+
{%- for item in site.pages -%}
19+
{%- if item.url contains section/ -%}
20+
{%- unless item.path contains "index" -%}
21+
<li class="section__item">
22+
<a href="{{ item.url | relative_url }}" class="section__link {% if item.url contains page.url and page.url != '/' and page.type != 'index' %} section__link--is-active{% endif %}">{{ item.title }}</a>
23+
</li>
24+
{%- endunless -%}
25+
{%- endif -%}
26+
{%- endfor -%}
27+
</ul>
28+
{%- endfor -%}
29+
</div>
2130
</nav>
22-
</div>
31+
</div>

_sass/modules/_layout.scss

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
$sidebar-width: 250px;
32
$logo-height: 130px;
43
$wrapper-width: 800px;
@@ -95,34 +94,16 @@ body {
9594
}
9695

9796
.sidebar__nav {
98-
padding: $spacing-unit $spacing-unit ($spacing-unit + $logo-height); // Add a bit more padding at the bottom for consistency.
97+
9998
font-weight: bold;
10099
max-height: 100%;
101-
overflow-y: scroll;
102-
103-
li {
104-
list-style: none;
105-
106-
a {
107-
color: $color-white;
108-
109-
&:hover {
110-
text-decoration: none;
111-
}
112-
}
113-
}
100+
overflow-y: auto;
114101
}
115102

116-
.section {
117-
margin: 0px;
118-
119-
> li {
120-
margin-bottom: $spacing-unit / 2;
121-
122-
&:last-child {
123-
margin-bottom: $spacing-unit;
124-
}
125-
}
103+
.sidebar__nav-interior {
104+
height: 100%;
105+
// Add a bit more padding at the bottom for consistency.
106+
padding: $spacing-unit $spacing-unit ($spacing-unit + $logo-height);
126107
}
127108

128109
.section__header {
@@ -131,27 +112,49 @@ body {
131112
color: $color-white;
132113
margin-top: 0;
133114
margin-bottom: $spacing-unit / 4;
115+
116+
.section__links + & {
117+
margin-top: $spacing-unit;
118+
}
134119
}
135120

136121
.section__links {
137-
margin-left: $spacing-unit / 2;
138-
margin-bottom: $spacing-unit;
139-
font-weight: normal;
140122
font-size: 0.9em;
123+
font-weight: normal;
124+
125+
list-style: none;
126+
margin-left: $spacing-unit / 2;
127+
}
128+
129+
.section__item {
130+
list-style: none;
141131
}
142132

143133
.section__link {
144134
display: inline-block;
145135
margin-top: $spacing-unit/4;
146136
opacity: 0.75;
147137
text-decoration: none;
138+
color: $color-white;
148139

149140
&:hover {
150141
opacity: 1;
142+
text-decoration: none;
143+
}
144+
145+
&:empty {
146+
// there is an error in the liquid logic that spits out a
147+
// empty last-child
148+
display: none;
149+
}
150+
151+
&:visited {
152+
color: $color-white;
151153
}
152154
}
153155

154156
.section__link--is-active {
155157
font-weight: bold;
156158
opacity: 1;
159+
color: $color-white;
157160
}

0 commit comments

Comments
 (0)