blob: 06304778129a7d22932e4a6656db1046bfc717e4 (
plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<link rel=author href="mailto:xiaochengh@chromium.org">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popover-anchor-scroll-display-ref.tentative.html">
<div class=spacer style="height: 200px"></div>
<p>There should be a green box attached to the right side of each orange box.</p>
<!-- Example using the `anchor` implicit reference element -->
<div class=ex>
<div class=anchor id=anchor1></div>
<div id=popover1 popover=manual anchor=anchor1></div>
</div>
<div class=spacer style="height: 200vh"></div>
<style>
.ex {
margin: 25px;
}
.ex div {
width: 100px;
height: 100px;
}
.anchor {
background: orange;
}
[popover] {
background: lime;
padding:0;
border:0;
}
#popover1 {
left: anchor(right);
top: anchor(top);
}
</style>
<script>
function raf() {
return new Promise(resolve => requestAnimationFrame(resolve));
}
async function runTest() {
popover1.showPopover();
// Render a frame at the intial scroll position.
await raf();
await raf();
document.documentElement.scrollTop = 100;
document.documentElement.classList.remove('reftest-wait');
// The popover should still be attached to the anchor.
}
runTest();
</script>
</html>
|