Repository navigation
Commit 3543b51
fix(comments): Reply focuses the reply box, author avatars with initials, mention menu at the caret, delete toast (#36105)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuRdCovTRVz9Jix7ehp9bq4j)_
repo:objectstack#1 · os-sales · session_01L6bhgU81jVj4Jk1kQNvLJ5
Fixes #36070
## What changes
Four small fixes to comments (epic #36062, phase 1), made in the shared
pieces so the comment panel of #36075 carries them over:
1. **Reply puts the caret in the reply box.** `ThreadedReplies` takes a
new optional `focusReplyOnOpen` prop: each time its reply input opens,
it expands the replies (when collapsed) and focuses the input.
`RecordActivityTimeline` passes it behind its Reply button. Default
`false`, so a host that always shows the input does not have every
thread pull focus on mount.
2. **Author avatar, 20 px.** New `CommentAuthorAvatar` (exported from
`@object-ui/plugin-detail`): the author's image, or their initials on
the same `Avatar` / `AvatarFallback` disc the people-field chips and
`PersonRow` draw, with the same `getPersonInitials` (now exported from
`@object-ui/fields`). It replaces the comment icon on every comment and
the hand-drawn first-letter disc on every reply.
3. **Mention menu at the caret.** `RichTextCommentInput` measures the
caret with a mirror element (`textareaCaret.ts`) and opens the menu
under the caret's line, or above it when the window has no room below
(menu taller than the space under the line, and more space above). Where
layout cannot be measured, it keeps its old place over the editor's top
left. Candidates and notifications are unchanged.
4. **Delete toast.** The record page's `handleDeleteComment` shows a
success toast "Comment deleted" (zh 评论已删除) after the server deleted the
row. A refused delete keeps its error toast. New key
`detail.commentDeleted` in all eleven locale packs.
Not changed: where comments sit and how they are structured (#36075 /
#36076).
**For #36075 to reuse:** `CommentAuthorAvatar` (avatar/initials),
`ThreadedReplies`' `focusReplyOnOpen` (pass `true` wherever the reply
input opens behind a Reply button), the mention placement inside
`RichTextCommentInput` (comes with the component), and the delete toast
in the host's `handleDeleteComment` (comes with the handler).
## Why
Measured on main in the showcase (account record, Activity tab, 1312
wide): after Reply, focus stayed on the Reply button, so typing went
nowhere; on a comment with a collapsed reply, Reply showed the input but
not the reply; comments without an avatar showed a comment icon; the
mention menu opened at the editor's top left; a delete showed nothing.
## Verification
- New `plugin-detail/src/__tests__/commentSmallFixes-36070.test.tsx` (10
tests): focus and expand on Reply, a CONTROL that the default does not
pull focus, initials (Latin and CJK) on comment and reply, the menu
below / above / clamped to the box / fallback when unmeasurable.
- `RecordDetailView.feedCommentEditDelete-12268.test.tsx`: the delete
now also asserts the success toast; Cancel and a refused delete assert
none.
- The comment row's old 14 px `STREAM_ICON_CELL` had no reader left once
the avatar cell replaced it; it is removed, and
`ui/e2e/narrow-drawer-time-34614.spec.ts` now reads
`COMMENT_AVATAR_CELL` (tokens `shrink-0`, `w-5`), the cell the row
draws.
- Local: `plugin-detail` suite 3660 passed; `i18n` + `fields` 5050
passed; `plugin-detail` type-check clean; eslint on the touched files
clean of new warnings.
- Browser, showcase on a fresh console build, before = main `493ad095`,
after = this branch. Focus read from `document.activeElement` after
Reply: before `BUTTON Reply`, after `INPUT Reply…`; typed text lands in
the reply input. Delete: before no toast, after "Comment deleted".
Reply on a comment with no replies, then typing without clicking (before
/ after):
| Before | After |
|---|---|
|

|

|
|

|

|
Reply on a comment whose reply is collapsed:
| Before | After |
|---|---|
|

|

|
|

|

|
Author avatar (no image set: initials):
| Before | After |
|---|---|
|

|

|
|

|

|
Mention menu, `@` at the end of the second line:
| Before | After |
|---|---|
|

|

|
Delete:
| Before | After |
|---|---|
|

|

|
Phone width (375, after): Reply on the collapsed thread expands it and
focuses the reply box; `@` on the second line opens the menu under the
caret.
| Reply, light | Reply, dark | Mention, light | Mention, dark |
|---|---|---|---|
|

|

|

|

|
The evidence images live on this branch's commits `7e6998c0` and
`adbf13df` and are each removed in the next commit, so they never reach
main.
Clause-②: yes (widening)
Metadata-protocol: none
Widening: `ThreadedRepliesProps.focusReplyOnOpen` (optional),
`CommentAuthorAvatar` + `CommentAuthorAvatarProps` exports,
`getPersonInitials` export from `@object-ui/fields`, locale key
`detail.commentDeleted`. Nothing removed or changed in meaning.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; eslint on the touched files passes (CI runs
`pnpm lint`).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgU81jVj4Jk1kQNvLJ5
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgU81jVj4Jk1kQNvLJ5 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 15b7f51 commit 3543b51
27 files changed
Lines changed: 496 additions & 39 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui
- e2e
- packages
- app-shell/src/views
- fields/src
- i18n/src/locales
- plugin-detail
- src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
569 | 570 | | |
570 | 571 | | |
571 | 572 | | |
572 | | - | |
| 573 | + | |
| 574 | + | |
573 | 575 | | |
574 | 576 | | |
575 | 577 | | |
576 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
577 | 589 | | |
578 | 590 | | |
579 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
| |||
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | | - | |
| 325 | + | |
| 326 | + | |
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
| 438 | + | |
437 | 439 | | |
438 | 440 | | |
439 | 441 | | |
| |||
446 | 448 | | |
447 | 449 | | |
448 | 450 | | |
| 451 | + | |
| 452 | + | |
449 | 453 | | |
450 | 454 | | |
451 | 455 | | |
| |||
494 | 498 | | |
495 | 499 | | |
496 | 500 | | |
| 501 | + | |
497 | 502 | | |
498 | 503 | | |
499 | 504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | 247 | | |
249 | 248 | | |
250 | | - | |
251 | | - | |
| 249 | + | |
| 250 | + | |
252 | 251 | | |
253 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
260 | | - | |
| 262 | + | |
| 263 | + | |
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
| |||
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
291 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
292 | 297 | | |
293 | 298 | | |
294 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3978 | 3978 | | |
3979 | 3979 | | |
3980 | 3980 | | |
3981 | | - | |
3982 | | - | |
| 3981 | + | |
| 3982 | + | |
3983 | 3983 | | |
3984 | 3984 | | |
3985 | 3985 | | |
| |||
4023 | 4023 | | |
4024 | 4024 | | |
4025 | 4025 | | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
4026 | 4029 | | |
4027 | 4030 | | |
4028 | 4031 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5398 | 5398 | | |
5399 | 5399 | | |
5400 | 5400 | | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
| 5404 | + | |
5401 | 5405 | | |
5402 | 5406 | | |
5403 | 5407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1688 | 1688 | | |
1689 | 1689 | | |
1690 | 1690 | | |
| 1691 | + | |
1691 | 1692 | | |
1692 | 1693 | | |
1693 | 1694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1510 | 1510 | | |
1511 | 1511 | | |
1512 | 1512 | | |
| 1513 | + | |
1513 | 1514 | | |
1514 | 1515 | | |
1515 | 1516 | | |
| |||
0 commit comments