Repository navigation
fix(react-core): honor chatInputToolbarAddButtonLabel in the add menu tooltip - #6771
Merged
Merged
Conversation
… tooltip
The add-menu ("+") button's tooltip hardcoded the string "Add attachments",
so `labels.chatInputToolbarAddButtonLabel` only retitled the menu item and
the tooltip stayed English. That blocked full localization of CopilotChat
without replacing the whole add-button slot.
Every other tooltip in the v2 chat surface is already label-driven, and the
Angular implementation already derives this tooltip from the same label, so
this was an oversight rather than a deliberate split.
The "/" shortcut glyph stays hardcoded — it is a key name, not prose.
Fixes #6750
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Contributor
|
Size Change: -25 B (0%) Total Size: 1.55 MB 📦 View Changed
ℹ️ View Unchanged
|
BenTaylorDev
marked this pull request as ready for review
August 28, 2026 18:54
BenTaylorDev
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
August 28, 2026 18:54
MikeRyanDev
approved these changes
Aug 28, 2026
This was referenced Oct 18, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 19, 2026
…abels (#7865) ## What does this PR do? Gives every icon-only button in the prebuilt chat an accessible name taken from the `labels` config, so screen readers announce it and apps can translate it. **React** (`@copilotkit/react-core/v2`): the send/stop, add, voice (start, cancel, finish), scroll-to-bottom and branch (previous/next) buttons had no accessible name. Some show a tooltip, but a tooltip only adds `aria-describedby` while open. - `CopilotChatInput.SendButton` is named `chatInputToolbarSendButtonLabel`, or `chatInputToolbarStopButtonLabel` while it stops a run. - `CopilotChatInput.AddMenuButton` and `CopilotChatInput.ToolbarButton` reuse the labels their tooltips already show. - `CopilotChatView.ScrollToBottomButton` is named `chatScrollToBottomLabel`. - `CopilotChatUserMessage.BranchNavigation` names its buttons `userMessageToolbarPreviousBranchLabel` / `userMessageToolbarNextBranchLabel`. **Vue**: - The send button said "Send message" even while it stops a run; it now uses the send or stop label. - The scroll-to-bottom button had no name; it now uses `chatScrollToBottomLabel`. - The branch buttons' hard-coded names now come from labels. **Angular**: the hard-coded send, scroll-to-bottom and branch-button names now come from `provideCopilotChatLabels`. New label keys. Each framework keeps the English text it used before as the default: | Key | React | Vue | Angular | | --- | --- | --- | --- | | `chatInputToolbarSendButtonLabel` | "Send message" | "Send message" | "Send message" | | `chatInputToolbarStopButtonLabel` | "Stop" | "Stop" | (no stop state on this button) | | `chatScrollToBottomLabel` | "Scroll to bottom" | "Scroll to bottom" | "Scroll to bottom" | | `userMessageToolbarPreviousBranchLabel` | "Previous branch" | "Previous branch" | "Previous message branch" | | `userMessageToolbarNextBranchLabel` | "Next branch" | "Next branch" | "Next message branch" | The change is additive. An `aria-label` passed through a slot still wins, and nothing changes visually: before and after screenshots of the repro page are byte-identical, apart from an animated pulse dot. The reference pages for `useCopilotChatConfiguration` (React, Vue) and `provideCopilotChatLabels` list the new keys. One existing test changed: the send-button case in `CopilotChatView.onClick.e2e.test.tsx` only asserted if it found `button[aria-label*="Send"]`, which never existed, so it passed without checking anything. With the label in place it found a disabled button. It now types into the composer, finds the button by name and asserts the click. ## Related PRs and Issues - Fixes #7862 - Same pattern as #6771 (label for the add-menu tooltip). - The design-refresh PR #7464 edits the same React button components (class names, icon stroke). The overlap is small, and I'm happy to rebase onto it, or onto whichever lands first. ## Testing New tests. Each fails against `main` and passes here, except two that pass on both by design (the slot `aria-label` override, and Vue's default "Send message"): - React: - `CopilotChatInput.test.tsx`, "accessible names" (5) - `CopilotChatView.scrollToBottomButton.test.tsx` (2) - `CopilotChatUserMessage.slots.e2e.test.tsx`, "branch navigation accessible names" (2) - Vue: - `CopilotChatInput.test.ts` (3) - `CopilotChatView.test.ts` (1) - `CopilotChatUserMessage.test.ts` (1) - Angular: `copilot-chat-buttons.spec.ts` (1) Checks: - `nx run-many -t check-types,test` for `react-core`, `vue` and `angular`, run one after another: react-core 1907 tests, vue 1185, angular 542 (1 skipped), all passing, and type checks clean. - `nx run-many -t build,publint,attw` for the same three: passing. - `oxlint` and `oxfmt --check` on the changed files: no new warnings. Browser check: a page built against `@copilotkit/react-core` packed from this branch, in Chromium 149 via Playwright `ariaSnapshot()`. Repro and capture script: https://github.com/Mordris/copilotkit-ui-repro | | 1.79.1 | This branch | | --- | --- | --- | | Buttons without a name | 6 of 12 | 0 of 12 | | Composer (idle) | `- button`, `- button`, `- button [disabled]` | `- button "Add attachments"`, `- button "Transcribe"`, `- button "Send message" [disabled]` | | Composer (running) | `- button` | `- button "Stop"` | | Same, with German `labels` | unchanged | `"Anhänge hinzufügen"`, `"Diktieren"`, `"Nachricht senden"`, `"Stoppen"` | ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) (not a breaking change) - [x] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Chat button labels are configurable across Angular, React, and Vue, including send/stop, message-branch navigation, and scroll-to-bottom controls. * Send and stop buttons announce the action currently available. * **Documentation** * Configuration references now list the new labels and their default text. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Laptopmini
pushed a commit
to Laptopmini/CopilotKit
that referenced
this pull request
Oct 27, 2026
…ed strings through labels (CopilotKit#7867) ## What does this PR do? Routes the prebuilt chat's remaining hard-coded strings through the `labels` config, so apps can translate them. | Key | Default | Where | | --- | --- | --- | | `reasoningMessageThinkingLabel` | "Thinking…" | reasoning header while the model reasons (React, Vue, Angular) | | `chatInputSlashMenuLabel` | "Slash commands" | name of the slash-command menu (React, Vue) | | `chatInputSlashMenuEmptyText` | "No commands found" | its empty state (React, Vue) | | `attachmentRemoveButtonLabel` | "Remove attachment" | queued attachment (React, Vue, Angular) | | `attachmentPlayVideoButtonLabel` | "Play video" | queued video (React, Vue) | | `attachmentPreviewCloseButtonLabel` | "Close preview" | attachment preview (React, Vue) | | `modalHeaderCloseButtonLabel` | "Close" | popup and sidebar header (React, Vue) | | `modalHeaderThreadsButtonLabel` | "Open threads" | threads drawer launcher (React, Vue) | | `sidebarLabel` | "Copilot chat sidebar" | name of the sidebar region (React, Vue) | **"Thought for N seconds"** carries a number and plural rules, which a plain string label can't express. Its English default stays as it is. The reasoning header slot now also receives `elapsedSeconds` (React; Vue's `header` and `layout` slots), so an app can render its own text with correct plurals: ```tsx <CopilotChat messageView={{ reasoningMessage: { header: ({ isStreaming, elapsedSeconds, ...props }) => ( <CopilotChatReasoningMessage.Header {...props} isStreaming={isStreaming} label={isStreaming ? "Denkt nach…" : `${Math.round(elapsedSeconds)} Sekunden nachgedacht`} /> ), }, }} /> ``` The change is additive: same English defaults, and no visual change unless an app sets the new labels. The reference pages for `useCopilotChatConfiguration` (React, Vue) and `provideCopilotChatLabels` list the new keys, and the reasoning-messages guide documents `elapsedSeconds`. Not included: - Angular's popup and sidebar close buttons keep their own names ("Close Copilot chat", "Close Copilot sidebar"). Angular's reasoning message has no header slot to pass `elapsedSeconds` to. - The A2UI renderer's own strings ("Building interface", "Retrying generation…", "Filter options...") are left out, since the A2UI catalog is being reworked in CopilotKit#7819 / CopilotKit#7829. ## Related PRs and Issues - Closes CopilotKit#7864 - Same pattern as CopilotKit#6771. Independent of CopilotKit#7865 (the icon-only button names): the two touch different keys and lines. ## Testing New tests. Each fails against `main` and passes here: - React: `CopilotChat.labels.test.tsx` (7). Covers every string above, plus `elapsedSeconds` reaching a custom header (fake timers: 0, then 3 after three seconds). - Vue: `CopilotChat.labels.test.ts` (6). - Angular: `copilot-chat-labels.spec.ts` (2). Checks: - `nx run-many -t check-types,test` for `react-core`, `vue` and `angular`, run one after another: react-core 1905 tests, vue 1186, angular 543 (1 skipped), all passing, and type checks clean. - `nx run-many -t build,publint,attw` for the same three: passing. - `oxlint` and `oxfmt --check` on the changed files: no new warnings. Browser check: a page built against `@copilotkit/react-core` packed from this branch, with German `labels`, in Chromium 149 via Playwright. Repro and capture script: https://github.com/Mordris/copilotkit-ui-repro | | 1.79.1 | This branch | | --- | --- | --- | | Reasoning header (streaming) | "Thinking…" | "Denkt nach…" | | Slash menu, no matches | `listbox "Slash commands": No commands found` | `listbox "Befehle": Keine Befehle gefunden` | | Attachment buttons | "Remove attachment", "Play video" | "Anhang entfernen", "Video abspielen" | | Preview close button | "Close preview" | "Vorschau schließen" | | Same page, English labels | | identical to 1.79.1 (byte-identical screenshot in light mode) | ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) (not a breaking change) - [x] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Chat labels can now be customized across Angular, React, and Vue for reasoning status, slash-command menus, attachment controls, modal buttons, and sidebar accessibility names. * Reasoning headers can access elapsed reasoning time to create localized labels. * Default labels are provided when custom labels are not set. * **Documentation** * Updated configuration references and customization guides to cover the new labels and elapsed-time information. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The add-menu ("+") button in
CopilotChatrenders its tooltip from a hardcoded string, solabels.chatInputToolbarAddButtonLabelretitles the menu item but leaves the tooltip in English:That blocks full localization of the chat UI unless you replace the entire add-button slot just to change one string.
packages/react-core/src/v2/components/chat/CopilotChatInput.tsx:1330(before):Why this is a bug, not a design choice
Two independent signals say the hardcoded string was an oversight:
CopilotChatInput.tsx:1186renders<p>{labels[labelKey]}</p>, andCopilotChatUserMessage.tsx:303/CopilotChatAssistantMessage.tsx:255both render<p>{title}</p>. The add-menu button was the only hardcoded tooltip in the package.packages/angular/src/lib/components/chat/copilot-chat-tools-menu.ts:183derives the same tooltip fromchatInputToolbarAddButtonLabel. React was the outlier.Change
One-line fix: the tooltip now reads the existing label.
I deliberately reused
chatInputToolbarAddButtonLabelrather than adding thechatInputToolbarAddButtonTooltipkey the issue also floated:"Add attachments"(CopilotChatConfigurationProvider.tsx:22), so the rendered default text is unchanged — no visual or snapshot regression.The
/shortcut glyph stays hardcoded: it is a key name, not prose.Out of scope (flagging, not fixing)
The React default for this label (
"Add attachments") differs from Vue's and Angular's ("Add photos or files"—packages/vue/src/v2/providers/types.ts:6,packages/angular/src/lib/chat-config.ts:30). That is a pre-existing cross-framework inconsistency; changing it here would silently alter someone's default string, so I left it alone. Vue's add button has no tooltip at all, so it needs no counterpart change.Testing
1. New test fails without the fix (mutation-checked, not a self-fulfilling probe).
Run against the unfixed source, the assertion catches the hardcoded string:
Worth noting: my first draft of this test used
user.hover()+findByRole("tooltip")and failed for the wrong reason (no tooltip ever rendered). This suite mocks@radix-ui/react-tooltipto a passthrough (src/v2/__tests__/setup.ts:92), so tooltip content renders eagerly and there is no real open/close orrole="tooltip". The committed test asserts on[data-slot="tooltip-content"]scoped to the add button's tooltip root, which is the convention this mock implies — and it demonstrably fails on unfixed code, as shown above.2. Target file green with the fix — 56/56.
3. Full
@copilotkit/react-coresuite: no regressions. Baseline at cleanHEADvs. this branch, same worktree, same command:HEAD(unfixed)Exactly +1 test and +1 pass — my added test — with the identical 7 failures on both sides. Those 7 pre-existing failures are in
CopilotChatView.pinToSend.test.tsx,use-pin-to-send.test.tsx, and threesrc/v1-deprecated/hooks/__tests__/files; none touch the add button or labels.4. Typecheck — zero errors in the touched files.
tsc --noEmitreports 21 pre-existing errors in this worktree, all in the inspector/threads family (use-inspector-thread-override.ts,inspector-thread-override.test.tsx,CopilotKitInspector.tsx,CopilotKitProvider.tsx,use-threads.tsx,CopilotChatMessageView.tsx,CopilotChat.tsx). None inCopilotChatInput.tsxor its test:5. Pre-commit hooks passed in full (not bypassed — no
--no-verify):test-and-check-packagesrunsnx run-many -t test,publint,attwfor the affected package, so react-core'stest,publint, andattwall passed. Formatting applied withoxfmt.Fixes #6750