You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a071479
Browse filesBrowse the repository at this point in the historyBrowse files
feat(Comments): a typingIndicator render prop shows who is typing
Comments drew typing state with Lab's ChatTypingIndicator, so Comments and
CommentThread imported a component that stays in Lab. `typingIndicator`
now renders it: while an open thread's `typingUsers` name someone besides
the viewer, Comments passes those people, each once, and places what the
function returns at the end of the thread. It follows `emojiPicker`'s
shape. Without it, typing shows nothing. The new
`CommentTypingIndicatorRenderProps` type names what the function receives.
Docs, the Live state story, and the panel showcase pass ChatTypingIndicator.
Copy file name to clipboardExpand all lines: packages/lab/src/Comments/CommentThread.doc.mjs
+35-4Lines changed: 35 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ export const docs = {
50
50
name: 'Live state',
51
51
required: false,
52
52
description:
53
-
'Controlled typing state follows the conversation while the thread is open, with its pulsing dots in the avatar column and its label on the comment-text line.',
53
+
'With `typingIndicator`, controlled typing state follows the conversation while the thread is open: the thread passes the people typing, each once and without the viewer.',
54
54
},
55
55
{
56
56
name: 'Reply composer',
@@ -78,7 +78,7 @@ export const docs = {
78
78
{
79
79
guidance: true,
80
80
description:
81
-
'Map your collaboration state to `typingUsers`, then publish local reply and edit activity with `onComposerDraftChange`. The thread never opens a connection or expires participants.',
81
+
'Map your collaboration state to `typingUsers` and show it with `typingIndicator`, then publish local reply and edit activity with `onComposerDraftChange`. The thread never opens a connection or expires participants.',
82
82
},
83
83
{
84
84
guidance: false,
@@ -111,6 +111,13 @@ export const docs = {
111
111
description:
112
112
'When a dismissal would discard an unsaved reply or edit, the thread stays open, focus returns to the draft, and a polite live region says the draft is unsaved and that dismissing again discards it. The shake is never the only signal.',
113
113
},
114
+
{
115
+
name: 'Typing indicator',
116
+
category: 'Content',
117
+
criterion: '4.1.3 Status Messages',
118
+
description:
119
+
'A standalone thread has no log, so the indicator `typingIndicator` returns says who is typing once per change, politely, unless your page puts the thread inside a live region that already speaks it. It keeps its motion safe under reduced motion.',
120
+
},
114
121
{
115
122
name: 'Reduced motion',
116
123
criterion: '2.3.3 Animation from Interactions',
@@ -276,6 +283,12 @@ export const docs = {
276
283
description:
277
284
'Renders the emoji picker the reply composer opens; pass `onSelect` to it. Without it, there is no emoji button. The picker fills a fixed-width panel with no padding, so it brings its own.',
'Map collaboration state to `typingUsers`; publish local drafts via `onComposerDraftChange`. No connections, no participant expiry.',
523
+
'Map collaboration state to `typingUsers`, show it via `typingIndicator`; publish local drafts via `onComposerDraftChange`. No connections, no participant expiry.',
502
524
},
503
525
{
504
526
guidance: false,
@@ -531,6 +553,13 @@ export const docsDense = {
531
553
description:
532
554
'A dismissal over an unsaved reply/edit keeps the thread open, refocuses the draft, and announces politely. Shake is never the only signal.',
533
555
},
556
+
{
557
+
name: 'Typing indicator',
558
+
category: 'Content',
559
+
criterion: '4.1.3 Status Messages',
560
+
description:
561
+
'No log in a standalone thread: the `typingIndicator` result announces who is typing once per change, politely, unless a live region already speaks it. Reduced-motion safe.',
562
+
},
534
563
{
535
564
name: 'Reduced motion',
536
565
criterion: '2.3.3 Animation from Interactions',
@@ -576,6 +605,8 @@ export const docsDense = {
576
605
getReplyMention: 'Seeds a reply-to-reply with an author mention.',
577
606
emojiPicker:
578
607
'({onSelect}) => picker for the reply composer (fixed width, no padding: bring your own); none = no emoji button.',
608
+
typingIndicator:
609
+
'({users}) => typing row at the end of the open thread; none = no typing row.',
579
610
renderAnchor: 'Replaces the quoted passage.',
580
611
renderBody: 'Replaces a comment’s Markdown body.',
581
612
renderVersionBody: 'Replaces a history version’s body.',
Copy file name to clipboardExpand all lines: packages/lab/src/Comments/Comments.doc.mjs
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ export const docs = {
74
74
name: 'Live state',
75
75
required: false,
76
76
description:
77
-
'Controlled typing state appears at the end of an open thread, with its pulsing dots in the avatar column and its label on the comment-text line.',
77
+
'With `typingIndicator`, controlled typing state appears at the end of an open thread: Comments passes the people typing, each once and without the viewer, and places what the function returns.',
78
78
},
79
79
{
80
80
name: 'Activity event',
@@ -108,7 +108,7 @@ export const docs = {
108
108
{
109
109
guidance: true,
110
110
description:
111
-
'Keep live state controlled and transport-neutral: map your collaboration layer to `typingUsers`, and use `onComposerDraftChange` to publish local activity. Keep other per-comment metadata, such as who has seen a comment, beside your own records and look it up by comment id in a render callback. Debounce and expire transient activity in your app.',
111
+
'Keep live state controlled and transport-neutral: map your collaboration layer to `typingUsers`, show it with `typingIndicator`, and use `onComposerDraftChange` to publish local activity. Keep other per-comment metadata, such as who has seen a comment, beside your own records and look it up by comment id in a render callback. Debounce and expire transient activity in your app.',
112
112
},
113
113
{
114
114
guidance: false,
@@ -133,7 +133,7 @@ export const docs = {
133
133
category: 'Content',
134
134
criterion: '4.1.3 Status Messages',
135
135
description:
136
-
'Typing is a polite status message with reduced-motion-safe dots.',
136
+
'Inside the threads log (the default layout), the log announces the indicator\'s text, so the indicator must not announce it again. With `layout="embedded"`, which has no log, the indicator says who is typing once per change, politely, and keeps its motionsafe under reduced motion.',
137
137
},
138
138
{
139
139
name: 'Thread toggle',
@@ -445,6 +445,12 @@ export const docs = {
445
445
description:
446
446
'Renders the emoji picker that composers open from their Add emoji button; pass `onSelect` to it. Without it, composers show no emoji button. The picker fills a fixed-width panel with no padding, so it brings its own.',
'Renders the typing indicator at the end of an open thread while its `typingUsers` name someone besides the viewer. `users` lists each person once, without the viewer. Without it, typing shows nothing.',
453
+
},
448
454
{
449
455
name: 'emptyState',
450
456
type: 'ReactNode',
@@ -614,14 +620,17 @@ import {Comments} from '@astryxdesign/lab';
614
620
},
615
621
{
616
622
label: 'Live collaboration state',
617
-
code: `import {Comments} from '@astryxdesign/lab';
623
+
code: `import {ChatTypingIndicator, Comments} from '@astryxdesign/lab';
0 commit comments