-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathAccessibleTooltip.css
More file actions
133 lines (119 loc) · 2.97 KB
/
Copy pathAccessibleTooltip.css
File metadata and controls
133 lines (119 loc) · 2.97 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
.accessible-tooltip {
position: relative;
display: inline-flex;
align-items: center;
margin-left: 6px;
vertical-align: middle;
}
.accessible-tooltip--inline {
margin-left: 0;
vertical-align: baseline;
}
.accessible-tooltip__trigger {
display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
padding: 0;
border: 1px solid rgba(88, 166, 255, 0.5);
border-radius: 999px;
background: transparent;
color: var(--accent);
font-size: 0.7rem;
font-weight: 700;
line-height: 1;
}
.accessible-tooltip__trigger--text {
width: auto;
height: auto;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
color: inherit;
font-size: inherit;
font-weight: inherit;
line-height: inherit;
}
.accessible-tooltip__label {
text-decoration: underline;
text-decoration-style: dotted;
text-decoration-thickness: 1px;
text-decoration-color: currentColor;
text-underline-offset: 0.18em;
}
.accessible-tooltip__trigger:hover,
.accessible-tooltip__trigger:focus-visible {
background: rgba(88, 166, 255, 0.12);
border-color: var(--accent);
}
.accessible-tooltip__trigger--text:hover,
.accessible-tooltip__trigger--text:focus-visible {
background: transparent;
border-color: transparent;
}
.accessible-tooltip__content {
position: absolute;
left: 50%;
bottom: calc(100% + 8px);
z-index: 20;
width: min(260px, calc(100vw - 2rem));
padding: 0.55rem 0.65rem;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--surface);
color: var(--text);
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
font-size: 0.78rem;
font-weight: 400;
line-height: var(--lh-small);
opacity: 0;
pointer-events: none;
transform: translate(-50%, 4px);
transition: opacity 120ms ease, transform 120ms ease;
}
.accessible-tooltip__content::after {
position: absolute;
left: 50%;
top: 100%;
width: 8px;
height: 8px;
border-right: 1px solid var(--border);
border-bottom: 1px solid var(--border);
background: var(--surface);
content: "";
transform: translate(-50%, -4px) rotate(45deg);
}
.accessible-tooltip__content.is-visible {
opacity: 1;
transform: translate(-50%, 0);
}
/* Bottom placement — flips the content below the trigger and mirrors the arrow. */
.accessible-tooltip--bottom .accessible-tooltip__content {
bottom: auto;
top: calc(100% + 8px);
transform: translate(-50%, -4px);
}
.accessible-tooltip--bottom .accessible-tooltip__content::after {
top: auto;
bottom: 100%;
border-right: 0;
border-bottom: 0;
border-left: 1px solid var(--border);
border-top: 1px solid var(--border);
transform: translate(-50%, 4px) rotate(45deg);
}
.accessible-tooltip--bottom .accessible-tooltip__content.is-visible {
transform: translate(-50%, 0);
}
@media (forced-colors: active) {
.accessible-tooltip__label {
text-decoration-color: LinkText;
}
.accessible-tooltip__content {
border-color: CanvasText;
background: Canvas;
color: CanvasText;
}
}