-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathTranscriptFocus.module.css
More file actions
117 lines (101 loc) · 4.03 KB
/
TranscriptFocus.module.css
File metadata and controls
117 lines (101 loc) · 4.03 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
/* Focus area container */
:global(.webchat) .transcript-focus-area {
display: grid;
grid-template-areas: 'content';
outline: 0;
--webchat__transcript--spacing: 10px;
.transcript-focus-area__indicator,
.transcript-focus-area__transcript-indicator {
box-sizing: border-box;
font-size: 0;
grid-area: content;
isolation: isolate;
min-height: 0;
pointer-events: none;
}
.transcript-focus-area__root,
.transcript-focus-area__content-root {
grid-area: content;
min-height: 0;
min-width: 0;
}
&:focus
.transcript-focus-area__content--focused
> .transcript-focus-area__content-overlay
.transcript-focus-area__indicator {
border-color: var(--webchat__color--transcript-activity-visual-keyboard-indicator);
border-style: var(--webchat__border-style--transcript-activity-visual-keyboard-indicator);
border-width: var(--webchat__border-width--transcript-activity-visual-keyboard-indicator);
inset: calc(var(--webchat__transcript--spacing) / -2) calc(var(--webchat__transcript--spacing) / 2)
calc(var(--webchat__transcript--spacing) / -2) calc(var(--webchat__transcript--spacing) / 2);
position: absolute;
}
&:focus-visible .transcript-focus-area__transcript-indicator,
.transcript-focus-area__root:has(.transcript-focus-area__terminator:focus-visible)
+ .transcript-focus-area__transcript-indicator {
border-color: var(--webchat__border-color--transcript-visual-keyboard-indicator);
border-style: var(--webchat__border-style--transcript-visual-keyboard-indicator);
border-width: var(--webchat__border-width--transcript-visual-keyboard-indicator);
}
.transcript-focus-area__activity-list {
display: grid;
gap: var(--webchat__transcript--spacing);
padding-block: var(--webchat__transcript--spacing);
}
.transcript-focus-area__content {
display: grid;
grid-template-areas: 'content';
min-height: 0;
min-width: 0;
> * {
grid-area: content;
min-width: 0;
}
}
/*
TODO: see if we can remove the wrapper along with absolute/relative positioning by:
- Using intersection observer to observe a given activity is in the view
- Supplying the edge we'd like the focus indicator to align with
Browser handles differently both bounding boxes and scroll into view for static vs relative/absolute positioning.
To account for the differences, we use absolute/relative positioning as the rest of our code assumes so.
*/
.transcript-focus-area__content-overlay {
min-height: 0;
grid-area: content;
/* The bounding box is expanded to both top and bottom to scroll focus indicator into view. */
/* We should ignore clicks to make sure this expansion don't register click as focus. */
/* Otherwise, when clicking on the very bottom edge of the activity, it will focus on next activity instead. */
pointer-events: none;
position: relative;
width: 100%;
}
/* When the content is focused as active descendant, scrollIntoView() will scroll this invisible div into view. */
.transcript-focus-area__content-active-descendant {
inset: calc(var(--webchat__transcript--spacing) / -1) 0 calc(var(--webchat__transcript--spacing) / -1) 0;
position: absolute;
}
.transcript-focus-area__terminator {
height: 0;
outline: 0;
position: relative;
width: 100%;
}
.transcript-focus-area__terminator-body {
display: flex;
inset: auto 0 0 0;
justify-content: center;
position: absolute;
}
.transcript-focus-area__terminator:not(:focus) .transcript-focus-area__terminator-body {
display: none;
}
.transcript-focus-area__terminator-text {
background: var(--webchat__background--transcript-terminator);
border-radius: var(--webchat__border-radius--transcript-terminator);
color: var(--webchat__color--transcript-terminator);
font-family: var(--webchat__font--primary);
font-size: var(--webchat__font-size--transcript-terminator);
margin: calc(var(--webchat__transcript--spacing) / 2);
padding: calc(var(--webchat__transcript--spacing) / 2);
}
}