-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathscroll-state-stuck-layout-change.html
49 lines (47 loc) · 1.32 KB
/
scroll-state-stuck-layout-change.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<title>@container: scroll-state(stuck) layout change</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#stuck">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<script src="/css/css-transitions/support/helper.js"></script>
<style>
#scroller {
overflow-y: scroll;
height: 300px;
}
#filler {
height: 100px;
}
#stuck {
container-type: scroll-state;
position: sticky;
bottom: 0;
height: 100px;
background-color: teal;
}
#target {
--stuck: no;
@container scroll-state(stuck: bottom) {
--stuck: yes;
}
}
</style>
<div id="scroller">
<div id="filler"></div>
<div id="stuck">
<span id="target"></span>
</div>
</div>
<script>
setup(() => assert_implements_scroll_state_container_queries());
promise_test(async t => {
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--stuck"), "no", "Initially not stuck");
});
promise_test(async t => {
filler.style.height = "400px";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--stuck"), "yes", "Stuck after #filler height changed");
});
</script>