Skip to content

Commit 12666a3

Browse files
committed
Fixed incompatibility between navigation.sections and navigation.indexes
1 parent ef0979f commit 12666a3

File tree

8 files changed

+52
-78
lines changed

8 files changed

+52
-78
lines changed

Diff for: material/assets/stylesheets/main.55b1b295.min.css

-2
This file was deleted.

Diff for: material/assets/stylesheets/main.55b1b295.min.css.map

-1
This file was deleted.

Diff for: material/assets/stylesheets/main.5a8d6a6f.min.css

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

Diff for: material/assets/stylesheets/main.5a8d6a6f.min.css.map

+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
@@ -39,7 +39,7 @@
3939
{% endif %}
4040
{% endblock %}
4141
{% block styles %}
42-
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.55b1b295.min.css' | url }}">
42+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.5a8d6a6f.min.css' | url }}">
4343
{% if config.theme.palette %}
4444
{% set palette = config.theme.palette %}
4545
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.3f5d1f46.min.css' | url }}">

Diff for: material/partials/nav-item.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{% else %}
3636
{% set index = indexes | first %}
3737
{% set class = "md-nav__link--active" if index == page %}
38-
<div class="md-nav__link md-nav__link--container {{ class }}">
38+
<div class="md-nav__link md-nav__link--index {{ class }}">
3939
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
4040
<label for="{{ path }}">
4141
<span class="md-nav__icon md-icon"></span>

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

+46-72
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@
9696

9797
// Navigation link
9898
&__link {
99-
display: block;
99+
display: flex;
100+
align-items: center;
101+
justify-content: space-between;
100102
margin-top: 0.625em;
101103
overflow: hidden;
102104
text-overflow: ellipsis;
103105
cursor: pointer;
104106
transition: color 125ms;
105107
scroll-snap-align: start;
106108

107-
// Link in blurred state
109+
// Navigation link in blurred state
108110
&[data-md-state="blur"] {
109111
color: var(--md-default-fg-color--light);
110112
}
@@ -114,9 +116,9 @@
114116
color: var(--md-typeset-a-color);
115117
}
116118

117-
// Navigation link in nested list
118-
.md-nav__item--nested > & {
119-
color: inherit;
119+
// Stretch section index link to full width
120+
.md-nav__item &--index [href] {
121+
width: 100%;
120122
}
121123

122124
// Navigation link on focus/hover
@@ -131,7 +133,7 @@
131133
outline-offset: px2rem(4px);
132134
}
133135

134-
// Navigation link to table of contents
136+
// Navigation link for table of contents
135137
.md-nav--primary &[for="__toc"] {
136138
display: none;
137139

@@ -149,6 +151,12 @@
149151
display: none;
150152
}
151153
}
154+
155+
// Navigation link children (for section indexes)
156+
> * {
157+
display: flex;
158+
cursor: pointer;
159+
}
152160
}
153161

154162
// Repository information container
@@ -272,17 +280,6 @@
272280
padding: 0;
273281
border-top: px2rem(1px) solid var(--md-default-fg-color--lightest);
274282

275-
// Navigation link in nested navigation
276-
&--nested > .md-nav__link {
277-
padding-right: px2rem(48px);
278-
279-
// Adjust for right-to-left languages
280-
[dir="rtl"] & {
281-
padding-right: px2rem(16px);
282-
padding-left: px2rem(48px);
283-
}
284-
}
285-
286283
// Navigation link in active navigation
287284
&--active > .md-nav__link {
288285
color: var(--md-typeset-a-color);
@@ -297,27 +294,17 @@
297294

298295
// Navigation link
299296
.md-nav__link {
300-
position: relative;
301297
margin-top: 0;
302298
padding: px2rem(12px) px2rem(16px);
303299

304300
// Navigation icon
305301
.md-nav__icon {
306-
position: absolute;
307-
top: 50%;
308-
right: px2rem(12px);
302+
flex-shrink: 0;
309303
width: px2rem(24px);
310304
height: px2rem(24px);
311-
margin-top: px2rem(-12px);
312-
color: inherit;
305+
margin-right: px2rem(-4px);
313306
font-size: px2rem(24px);
314307

315-
// Adjust for right-to-left languages
316-
[dir="rtl"] & {
317-
right: initial;
318-
left: px2rem(12px);
319-
}
320-
321308
// Navigation icon in link to next level
322309
&::after {
323310
display: block;
@@ -344,11 +331,6 @@
344331
// Table of contents contained in primary navigation
345332
.md-nav--secondary {
346333

347-
// Navigation link - omit unnecessary layering
348-
.md-nav__link {
349-
position: static;
350-
}
351-
352334
// Navigation on level 2-6
353335
.md-nav {
354336
position: static;
@@ -442,14 +424,7 @@
442424

443425
// Show link to table of contents
444426
&--primary &__link[for="__toc"] {
445-
display: block;
446-
padding-right: px2rem(48px);
447-
448-
// Adjust for right-to-left languages
449-
[dir="rtl"] & {
450-
padding-right: px2rem(16px);
451-
padding-left: px2rem(48px);
452-
}
427+
display: flex;
453428

454429
// Show table of contents icon
455430
.md-icon::after {
@@ -481,15 +456,7 @@
481456

482457
// Show link to integrated table of contents
483458
&--integrated &__link[for="__toc"] {
484-
display: block;
485-
padding-right: px2rem(48px);
486-
scroll-snap-align: initial;
487-
488-
// Adjust for right-to-left languages
489-
[dir="rtl"] & {
490-
padding-right: px2rem(16px);
491-
padding-left: px2rem(48px);
492-
}
459+
display: flex;
493460

494461
// Show table of contents icon
495462
.md-icon::after {
@@ -570,23 +537,26 @@
570537
margin-bottom: 0;
571538
}
572539

573-
// Hide navigation link, as sections are always expanded
540+
// Show navigation link as title
574541
> .md-nav__link {
575-
display: none;
542+
font-weight: 700;
543+
pointer-events: none;
544+
545+
// Make navigation link clickable
546+
&--index [href] {
547+
pointer-events: initial;
548+
}
549+
550+
// Hide naviation icon
551+
.md-nav__icon {
552+
display: none;
553+
}
576554
}
577555

578556
// Navigation
579557
> .md-nav {
580558
display: block;
581559

582-
// Navigation title
583-
> .md-nav__title {
584-
display: block;
585-
padding: 0;
586-
pointer-events: none;
587-
scroll-snap-align: start;
588-
}
589-
590560
// Adjust spacing on next level item
591561
> .md-nav__list > .md-nav__item {
592562
padding: 0;
@@ -630,13 +600,13 @@
630600
// Modifier for when navigation tabs are rendered
631601
&--lifted {
632602

633-
// Hide nested level 0 items and site title
603+
// Hide nested level 0 navigation items and site title
634604
> .md-nav__list > .md-nav__item--nested,
635605
> .md-nav__title {
636606
display: none;
637607
}
638608

639-
// Hide level 0 items
609+
// Hide level 0 navigation items
640610
> .md-nav__list > .md-nav__item {
641611
display: none;
642612

@@ -645,17 +615,21 @@
645615
display: block;
646616
padding: 0;
647617

648-
// Hide nested links
618+
// Show navigation link as title
649619
> .md-nav__link {
650-
display: none;
651-
}
652-
653-
// Show title and adjust spacing
654-
> .md-nav > .md-nav__title {
655-
display: block;
656620
padding: 0 px2rem(12px);
621+
font-weight: 700;
657622
pointer-events: none;
658-
scroll-snap-align: start;
623+
624+
// Make navigation link clickable
625+
&--index [href] {
626+
pointer-events: initial;
627+
}
628+
629+
// Hide naviation icon
630+
.md-nav__icon {
631+
display: none;
632+
}
659633
}
660634
}
661635
}
@@ -665,7 +639,7 @@
665639
.md-nav[data-md-level="1"] {
666640
display: block;
667641

668-
// Adjust spacing for level 1 items
642+
// Adjust spacing for level 1 navigation items
669643
> .md-nav__list > .md-nav__item {
670644
padding-right: px2rem(12px);
671645
}

Diff for: src/partials/nav-item.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
{% else %}
8585
{% set index = indexes | first %}
8686
{% set class = "md-nav__link--active" if index == page %}
87-
<div class="md-nav__link md-nav__link--container {{ class }}">
87+
<div class="md-nav__link md-nav__link--index {{ class }}">
8888
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
8989
<label for="{{ path }}">
9090
<span class="md-nav__icon md-icon"></span>

0 commit comments

Comments
 (0)