Skip to content

Commit 7c5efdf

Browse files
committed
Lazily render the sub-content area on mobile
1 parent 8c0acf4 commit 7c5efdf

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

_includes/css/csswizardry.min.css

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

_layouts/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1 elementtiming="page-title">{{ page.title }}</h1>
1616

1717
<script>performance.mark('contentEnd')</script>
1818
</section
19-
><section class="layout__item desk-three-tenths desk-push-one-tenth" data-ui-component="Sub content" id="section:sub-content">
19+
><section class="layout__item desk-three-tenths desk-push-one-tenth c-sub-content" data-ui-component="Sub content" id="section:sub-content">
2020

2121
{% include sub-content.html %}
2222

css/_components.sub-content.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* ==========================================================================
2+
#SUB-CONTENT
3+
========================================================================== */
4+
5+
/**
6+
* One small screens, there’s no point eagerly rendering all the sub-content
7+
* area. Use `content-visibility` to defer rendering until the user approaches.
8+
*/
9+
10+
.c-sub-content {
11+
content-visibility: auto;
12+
contain-intrinsic-size: 1px 1500px;
13+
14+
@include media-query(desk) {
15+
content-visibility: visible;
16+
contain-intrinsic-size: none none;
17+
}
18+
19+
}

css/csswizardry.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
* Promo................Lead promo blocks on the home page.
5353
* Site-nav.............Site’s main nav area.
5454
* Nav-secondary........Smaller, in-page nav.
55+
* Sub-content..........Site’s sub-content/sidebar.
5556
* Buttons..............Extension of inuitcss’ buttons.
5657
* Boxes................Extension of inuitcss’ box object
5758
* Post.................Post-specific styles.
@@ -195,6 +196,7 @@ $inuit-enable-list-ui--small: true;
195196
@import "components.promo";
196197
@import "components.site-nav";
197198
@import "components.nav-secondary";
199+
@import "components.sub-content";
198200
@import "components.buttons";
199201
@import "components.boxes";
200202
@import "components.post";

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h3 class="post__title" style="view-transition-name: x-{{ post.date | date: '%Y-
112112
<script>performance.mark('contentEnd')</script>
113113
</div
114114

115-
><div class="layout__item lap-and-up-one-half desk-one-third" data-ui-component="Sub content">
115+
><div class="layout__item lap-and-up-one-half desk-one-third c-sub-content" data-ui-component="Sub content">
116116

117117
<div class="[ box box--highlight ] mb">
118118
{% include sub-content.html %}

0 commit comments

Comments
 (0)