Skip to content

Commit d2a90b9

Browse files
authored
fix(web): name message copy actions accurately (pingdotgg#12865)
1 parent 2d377bf commit d2a90b9

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

‎apps/web/src/components/chat/MessageCopyButton.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const MessageCopyButton = memo(function MessageCopyButton({
3737
<TooltipTrigger
3838
render={
3939
<Button
40-
aria-label="Copy link"
40+
aria-label="Copy message"
4141
disabled={isCopied}
4242
onClick={() => copyToClipboard(text)}
4343
ref={ref}
@@ -51,7 +51,7 @@ export const MessageCopyButton = memo(function MessageCopyButton({
5151
{isCopied ? <CheckIcon className="size-3 text-primary" /> : <CopyIcon className="size-3" />}
5252
</TooltipTrigger>
5353
<TooltipPopup>
54-
<p>Copy to clipboard</p>
54+
<p>Copy message</p>
5555
</TooltipPopup>
5656
</Tooltip>
5757
);

‎apps/web/src/components/chat/MessagesTimeline.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ describe("MessagesTimeline", () => {
13201320
/>,
13211321
);
13221322

1323-
expect(markup).toContain('aria-label="Copy link"');
1323+
expect(markup).toContain('aria-label="Copy message"');
13241324
expect(markup).toContain('data-user-message-collapsed="true"');
13251325
expect(markup).toContain('data-user-message-footer="true"');
13261326
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Action names agree across presentations
2+
3+
Proposed invariant: a command's visible label, tooltip, menu wording and accessible
4+
name describe the same action on the same object. An icon-only presentation must
5+
retain that meaning. This applies to shared web/Electron controls and corresponding
6+
React Native iOS/Android actions, wherever those actions are available.
7+
8+
Separate strings can drift while each presentation still looks plausible. A message
9+
copy action called “Copy link” promises a different clipboard payload to someone
10+
using a screen reader. Use wording that identifies the actual target, including
11+
when a message contains links or structured context. Additional clipboard formats
12+
do not turn copying a message into copying a link.
13+
14+
This proposal draws on Apple's [Writing](https://developer.apple.com/design/human-interface-guidelines/writing)
15+
and [Accessibility](https://developer.apple.com/design/human-interface-guidelines/accessibility)
16+
guidance. It is a product constraint, not a claim of Apple certification or complete
17+
application compliance.
18+
19+
## Boundaries
20+
21+
Native menus and assistive technologies may use different wording or omit a tooltip.
22+
Labels need semantic agreement, not identical strings across platforms. A contextual
23+
“Copy” is sufficient when its target is unambiguous; do not globally expand it.
24+
Temporary “Copied” feedback may replace an action label without implying a different
25+
target. Clipboard transport, success timing and error reporting are separate concerns.
26+
27+
## Observable cases
28+
29+
- User and assistant message copy controls identify the message, in both tooltip
30+
and accessible name. Collapsing a long message does not change the action's meaning.
31+
- Copying a message with structured context still identifies the message; it does
32+
not promise to copy only a context link.
33+
- Code and plan copy actions retain their own targets. A contextual plan menu can
34+
say “Copy to clipboard”; a code control must not be announced as copying a message.
35+
- An icon, labeled button or native menu for an equivalent command conveys the same
36+
operation. Completed feedback never names a different object.
37+
38+
Verify visible wording alongside the runtime accessible name and resulting action.
39+
Source inspection and screenshots alone do not establish accessibility-tree behavior.

0 commit comments

Comments
 (0)