summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display.tentative.html
blob: bddc44006dfba675982454f55807c8af39b5a983 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:masonf@chromium.org">
<link rel=help href="https://open-ui.org/components/popover.research.explainer">
<link rel=help href="https://html.spec.whatwg.org/multipage/popover.html">
<link rel=match href="popover-anchor-display-ref.html">
<link rel=stylesheet href="/fonts/ahem.css">
<script src="resources/popover-utils.js"></script>

<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 defaultopen></div>
</div>

<!-- Example with `anchor` attribute but not using it for anchor pos -->
<div class=ex>
  <div id=anchor2 class=anchor></div>
  <div id=popover2 popover=manual anchor defaultopen></div>
</div>

<!-- Example using `anchor-name` plus inset, and no `anchor` attribute -->
<div class=ex>
  <div id=anchor3 class=anchor></div>
  <div id=popover3 popover=manual defaultopen></div>
</div>

<!-- Example using implicit anchor reference and inline anchor element -->
<div class=ex>
  <span id=anchor4>X</span>
  <div id=popover4 popover=manual anchor=anchor4 defaultopen></div>
</div>

<!-- Example using an implicit anchor which is not the default anchor -->
<div class=ex>
  <div class=anchor id=anchor5></div>
  <div id=popover5 popover=manual anchor=anchor5 defaultopen></div>
</div>

<!-- Example using a default anchor which is not the implicit anchor -->
<div class=ex>
  <div class=anchor id=anchor6></div>
  <div id=popover6 popover=manual anchor=anchor1 defaultopen></div>
</div>

<script>
showDefaultopenPopoversOnLoad();
</script>

<style>
  .ex {
    margin: 15px;
  }
  .ex div {
    width: 50px;
    height: 50px;
  }
  .anchor {
    background: orange;
  }
  [popover] {
    background: lime;
    padding:0;
    border:0;
  }
  #popover1 {
    left: anchor(right);
    top: anchor(top);
  }
  #anchor2 {
    anchor-name: --anchor2;
  }
  #popover2 {
    left: anchor(--anchor2 right);
    top: anchor(--anchor2 top);
  }
  #anchor3 {
    anchor-name: --anchor3;
  }
  #popover3 {
    inset:auto;
    left: anchor(--anchor3 right);
    top: anchor(--anchor3 top);
  }
  #anchor4 {
    font-family: Ahem;
    font-size: 50px;
    color: orange;
  }
  #popover4 {
    left: anchor(right);
    top: anchor(top);
  }
  #popover5 {
    position-anchor: --anchor1; /* shouldn't be used */
    left: anchor(implicit right);
    top: anchor(implicit top);
  }
  #anchor6 {
    anchor-name: --anchor6;
  }
  #popover6 {
    position-anchor: --anchor6;
    left: anchor(right); /* shouldn't use the implicit anchor */
    top: anchor(top);
  }
</style>