Skip to content

Commit f310c58

Browse files
committed
Add layout shift caused by non-composited animation
1 parent d0be595 commit f310c58

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<li><a href="idle-callback-time/index.html">idle-callback-time</a></li>
1818
<li><a href="initiators/index.html">initiators</a></li>
1919
<li><a href="layout-shift/index.html">layout-shift</a></li>
20+
<li><a href="layout-shift-animations/index.html">layout-shift-animations</a></li>
2021
<li><a href="layout-shift-unsized-images/index.html">layout-shift-unsized-images</a></li>
2122
<li><a href="lcp-critical-path/index.html">lcp-critical-path</a></li>
2223
<li><a href="lcp-discovery-delay/index.html">lcp-discovery-delay</a></li>

layout-shift-animations/app.js

Whitespace-only changes.

layout-shift-animations/index.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<html>
2+
<head>
3+
<title>Layout Shift from non-composited animation on load</title>
4+
<style>
5+
.box {
6+
height: 100px;
7+
width: 100px;
8+
}
9+
#red {
10+
background-color: red;
11+
animation: 0.2s linear 0s 1 forwards change-height;
12+
}
13+
@keyframes change-height {
14+
from {
15+
height: 100px;
16+
}
17+
to {
18+
height: 300px;
19+
}
20+
}
21+
p {
22+
font-family: sans-serif;
23+
}
24+
</style>
25+
</head>
26+
<body>
27+
<div id="red" class="box"></div>
28+
<p>This is some text content below the animated box.</p>
29+
<p>
30+
When the red box above changes height, this text will be pushed down,
31+
causing a layout shift.
32+
</p>
33+
<p>This makes the impact of the non-composited animation very clear.</p>
34+
<script src="app.js"></script>
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)