Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🧽 refactor: Drop Redundant Button Overrides in Chat Messages and Input (#16838)

Marco Beretta1a86069e252f
diff --git a/client/src/components/Chat/Input/AskUserQuestionPopover.tsx b/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
index 39e3df3414..c8d7c25565 100644
--- a/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
+++ b/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
@@ -207,7 +207,7 @@ function AskUserQuestionPopoverPanel({
should still come from the recipe. */}
<Button
variant="ghost"
- className="text-text-secondary hover:text-text-primary h-auto cursor-text rounded-md p-0 text-xs font-normal hover:bg-transparent"
+ className="text-text-secondary h-auto cursor-text rounded-md p-0 text-xs font-normal hover:bg-transparent"
onClick={() => textAreaRef?.current?.focus()}
>
{options.length === 0
diff --git a/client/src/components/Chat/Input/Files/MyFilesModal.tsx b/client/src/components/Chat/Input/Files/MyFilesModal.tsx
index 3001a283be..f2680c2fe2 100644
--- a/client/src/components/Chat/Input/Files/MyFilesModal.tsx
+++ b/client/src/components/Chat/Input/Files/MyFilesModal.tsx
@@ -45,7 +45,7 @@ export function MyFilesModal({
<OGDialogContent
title={localize('com_nav_my_files')}
onOpenAutoFocus={captureReturnFocus}
- className="bg-surface-dialog text-text-primary w-11/12 shadow-2xl"
+ className="text-text-primary w-11/12 shadow-2xl"
>
<OGDialogHeader>
<OGDialogTitle>{localize('com_nav_my_files')}</OGDialogTitle>
diff --git a/client/src/components/Chat/Input/Files/Table/Columns.tsx b/client/src/components/Chat/Input/Files/Table/Columns.tsx
index 2c2c6985a7..2e9c7fed7e 100644
--- a/client/src/components/Chat/Input/Files/Table/Columns.tsx
+++ b/client/src/components/Chat/Input/Files/Table/Columns.tsx
@@ -90,7 +90,7 @@ export const columns: ColumnDef<TFile>[] = [
render={
<Button
variant="ghost"
- className="hover:bg-surface-hover px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
+ className="px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
aria-sort={ariaSort}
aria-label={localize('com_ui_name_sort')}
@@ -150,7 +150,7 @@ export const columns: ColumnDef<TFile>[] = [
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
- className="hover:bg-surface-hover px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
+ className="px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
aria-sort={ariaSort}
aria-label={localize('com_ui_date_sort')}
aria-hidden="true"
@@ -268,7 +268,7 @@ export const columns: ColumnDef<TFile>[] = [
render={
<Button
variant="ghost"
- className="hover:bg-surface-hover px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
+ className="px-2 py-0 text-xs sm:px-2 sm:py-2 sm:text-sm"
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
aria-sort={ariaSort}
aria-label={localize('com_ui_size_sort')}
diff --git a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
index 760c0711a0..70b5752398 100644
--- a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
@@ -737,7 +737,7 @@ export default function Breakdown({
{langfuseSessionUrl && (
<>
<div className="border-border-light border-t" role="separator" />
- <Button asChild variant="link" className="h-auto w-full justify-between gap-2 p-0">
+ <Button asChild variant="link" className="h-auto w-full justify-between p-0">
<a href={langfuseSessionUrl} target="_blank" rel="noopener noreferrer">
<span>{localize('com_ui_langfuse_view_session')}</span>
<ExternalLink className="size-4 shrink-0" aria-hidden="true" />
diff --git a/client/src/components/Chat/Input/TokenUsage/CompactAction.tsx b/client/src/components/Chat/Input/TokenUsage/CompactAction.tsx
index d9123a1a21..85a3e615d2 100644
--- a/client/src/components/Chat/Input/TokenUsage/CompactAction.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/CompactAction.tsx
@@ -36,7 +36,7 @@ function CompactAction({ compact, canCompact, isCompacting }: CompactActionProps
disabled={!canCompact}
aria-busy={isCompacting}
aria-describedby={descriptionId}
- className="h-8 w-full justify-center gap-2 text-sm"
+ className="h-8 w-full justify-center"
>
{isCompacting ? (
<Spinner className="size-4" />
diff --git a/client/src/components/Chat/Messages/Content/AgentHandoff.tsx b/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
index 6e77e64911..38155b2b12 100644
--- a/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
+++ b/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
@@ -167,7 +167,7 @@ const AgentHandoff: React.FC<AgentHandoffProps> = ({ name, args: _args = '' }) =
<Button
variant="ghost"
className={cn(
- 'tool-status-text text-text-secondary hover:text-text-primary h-auto justify-start gap-2 rounded-none p-0 font-normal hover:bg-transparent',
+ 'tool-status-text text-text-secondary hover:text-text-primary h-auto justify-start rounded-none p-0 font-normal hover:bg-transparent',
!hasInfo && 'pointer-events-none disabled:opacity-100',
)}
disabled={!hasInfo}
diff --git a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx
index cd7bb6d039..d8982d6ec3 100644
--- a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx
+++ b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx
@@ -64,7 +64,7 @@ export default function MemoryArtifacts({ attachments }: { attachments?: TAttach
<Button
variant="ghost"
className={cn(
- 'group/disclosure h-auto w-full justify-start gap-2 rounded-none p-0 font-normal hover:bg-transparent',
+ 'group/disclosure h-auto w-full justify-start rounded-none p-0 font-normal hover:bg-transparent',
hasErrors ? 'text-status-error' : 'text-text-secondary',
)}
onClick={() => setShowInfo((prev) => !prev)}
diff --git a/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx b/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
index ba753ae572..36e7b6fe45 100644
--- a/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
@@ -128,7 +128,7 @@ const ArtifactRow = forwardRef<HTMLButtonElement, ArtifactRowProps>(function Art
size="icon"
onClick={onDownload}
aria-label={`${localize('com_ui_download')} ${title}`}
- className="text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:ring-text-primary size-5 shrink-0 rounded focus-visible:ring-offset-0"
+ className="text-text-secondary size-5 shrink-0 rounded focus-visible:ring-offset-0"
>
<Download className="size-4" aria-hidden="true" />
</Button>
diff --git a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
index 4adfb893f6..1ef5939818 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
@@ -86,7 +86,7 @@ const PreviewPlaceholderRow = memo(
size="icon"
onClick={handleDownload}
aria-label={`${localize('com_ui_download')} ${visibleFilename}`}
- className="text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:ring-text-primary size-5 shrink-0 rounded focus-visible:ring-offset-0"
+ className="text-text-secondary size-5 shrink-0 rounded focus-visible:ring-offset-0"
>
<Download className="size-4" aria-hidden="true" />
</Button>
diff --git a/client/src/components/Chat/Messages/Content/Parts/Summary.tsx b/client/src/components/Chat/Messages/Content/Parts/Summary.tsx
index 0ac7a96c8b..565f6ad9f4 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Summary.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Summary.tsx
@@ -110,7 +110,7 @@ const SummaryButton = memo(
isCopied ? localize('com_ui_copied_to_clipboard') : localize('com_ui_copy_summary')
}
className={cn(
- 'text-text-secondary-alt size-auto rounded-lg p-1.5',
+ 'text-text-secondary-alt size-auto p-1.5',
isExpanded
? 'opacity-0 group-focus-within/summary-container:opacity-100 group-hover/summary-container:opacity-100'
: 'opacity-0',
diff --git a/client/src/components/Chat/Messages/Content/ToolCall.tsx b/client/src/components/Chat/Messages/Content/ToolCall.tsx
index e02114abb0..e295b77c6e 100644
--- a/client/src/components/Chat/Messages/Content/ToolCall.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolCall.tsx
@@ -484,7 +484,7 @@ export default function ToolCall({
<div className="flex w-full flex-col gap-2.5">
<div className="mt-2 mb-1">
<Button
- className="inline-flex items-center justify-center rounded-xl px-4 py-2 text-sm font-medium"
+ className="inline-flex items-center justify-center rounded-xl font-medium"
variant="default"
rel="noopener noreferrer"
disabled={oauthBinding === 'pending'}
diff --git a/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx b/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
index 40bd2bf725..22b4760615 100644
--- a/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
@@ -220,7 +220,7 @@ export default function OutputRenderer({
<Button
variant="link"
size="sm"
- className="text-text-secondary focus-visible:ring-border-heavy mt-1 block h-auto p-0 text-xs underline focus-visible:ring-2"
+ className="text-text-secondary focus-visible:ring-border-heavy mt-1 block h-auto p-0 text-xs underline"
onClick={() => setShowErrorDetails((prev) => !prev)}
>
{localize('com_ui_details')}
diff --git a/client/src/components/Chat/Messages/Content/WebSearch.tsx b/client/src/components/Chat/Messages/Content/WebSearch.tsx
index b46f508c4f..c6e9cbaced 100644
--- a/client/src/components/Chat/Messages/Content/WebSearch.tsx
+++ b/client/src/components/Chat/Messages/Content/WebSearch.tsx
@@ -253,7 +253,7 @@ export default function WebSearch({
<Button
variant="disclosure"
className={cn(
- 'tool-status-text group/disclosure text-text-secondary h-5 min-w-0 justify-start gap-2 rounded-full p-0 font-normal',
+ 'tool-status-text group/disclosure text-text-secondary h-5 min-w-0 justify-start rounded-full p-0 font-normal',
/** This row is a status line, not a padded control: the shared
* recipe's color transition would turn its hover into a fade,
* and the chevron reveal beside it is deliberately instant. */
diff --git a/client/src/components/Chat/Messages/MinimalHoverButtons.tsx b/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
index 6754727f48..c90f0c0d27 100644
--- a/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
+++ b/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
@@ -49,7 +49,7 @@ export default function MinimalHoverButtons({ message, searchResults, variant }:
: localize('com_ui_copy_to_clipboard')
}
className={cn(
- 'text-text-secondary-alt ml-0 flex size-auto items-center gap-1.5 rounded-lg p-1.5 text-xs',
+ 'text-text-secondary-alt ml-0 flex size-auto items-center gap-1.5 p-1.5 text-xs',
'hover:bg-surface-hover hover:text-text-primary',
'focus-visible:ring-text-primary focus-visible:ring-2',
revealOnRowHoverClasses,
diff --git a/client/src/components/Chat/Messages/SiblingSwitch.tsx b/client/src/components/Chat/Messages/SiblingSwitch.tsx
index 27a3dd3f09..f94584133d 100644
--- a/client/src/components/Chat/Messages/SiblingSwitch.tsx
+++ b/client/src/components/Chat/Messages/SiblingSwitch.tsx
@@ -31,7 +31,7 @@ export default function SiblingSwitch({
};
const buttonStyle = cn(
- 'hover-button h-auto rounded-lg p-1.5 text-text-secondary-alt',
+ 'hover-button h-auto p-1.5 text-text-secondary-alt',
'hover:text-text-primary hover:bg-surface-hover',
'group-hover:visible group-focus-visible:visible group-has-[:focus-visible:not(:is(input,textarea,[contenteditable]))]:visible group-[.final-completion]:visible',
'focus-visible:ring-2 focus-visible:ring-text-primary',
diff --git a/e2e/specs/mock/scenarios/message-actions.spec.ts b/e2e/specs/mock/scenarios/message-actions.spec.ts
new file mode 100644
index 0000000000..ae5e157ef7
--- /dev/null
+++ b/e2e/specs/mock/scenarios/message-actions.spec.ts
@@ -0,0 +1,31 @@
+import { expect, test } from '@playwright/test';
+import {
+ NEW_CHAT_PATH,
+ replyText,
+ replyPrompt,
+ messagesView,
+ selectMockEndpoint,
+ sendMessageAndWaitForCompletion,
+} from '../helpers';
+
+const ENDPOINT = { label: 'Mock Provider A', model: 'mock-model-a' };
+
+test.describe('message actions', () => {
+ test('a finished reply offers a copy action that shows a focus ring on keyboard focus @scenario:message-actions-render', async ({
+ page,
+ }) => {
+ const label = `actions-${Date.now()}`;
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+ await selectMockEndpoint(page, ENDPOINT);
+ const response = await sendMessageAndWaitForCompletion(page, replyPrompt(label));
+ expect(response.ok()).toBeTruthy();
+ await expect(messagesView(page).getByText(replyText(label))).toBeVisible();
+
+ const copy = messagesView(page).getByRole('button', { name: 'Copy to clipboard' }).last();
+ await copy.focus();
+ await expect(copy).toBeVisible();
+ await expect(copy).toBeFocused();
+ const ring = await copy.evaluate((node) => getComputedStyle(node).boxShadow);
+ expect(ring).not.toBe('none');
+ });
+});
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index 98f88944de..2519e03c13 100644
--- a/eslint-suppressions.json
+++ b/eslint-suppressions.json
@@ -113,7 +113,7 @@
},
"client/src/components/Chat/Input/AskUserQuestionPopover.tsx": {
"shadcn/no-restyle": {
- "count": 7
+ "count": 6
}
},
"client/src/components/Chat/Input/ChatForm.tsx": {
@@ -160,7 +160,7 @@
},
"client/src/components/Chat/Input/Files/MyFilesModal.tsx": {
"shadcn/no-restyle": {
- "count": 3
+ "count": 2
}
},
"client/src/components/Chat/Input/Files/PastedTextDialog.tsx": {
@@ -183,7 +183,7 @@
},
"client/src/components/Chat/Input/Files/Table/Columns.tsx": {
"shadcn/no-restyle": {
- "count": 21
+ "count": 18
}
},
"client/src/components/Chat/Input/Files/Table/DataTable.tsx": {
@@ -241,12 +241,7 @@
},
"client/src/components/Chat/Input/TokenUsage/Breakdown.tsx": {
"shadcn/no-restyle": {
- "count": 13
- }
- },
- "client/src/components/Chat/Input/TokenUsage/CompactAction.tsx": {
- "shadcn/no-restyle": {
- "count": 2
+ "count": 12
}
},
"client/src/components/Chat/Input/TokenUsage/index.tsx": {
@@ -331,7 +326,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 9
+ "count": 8
}
},
"client/src/components/Chat/Messages/Content/AskUserQuestion.tsx": {
@@ -380,7 +375,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 7
+ "count": 6
}
},
"client/src/components/Chat/Messages/Content/MemoryInfo.tsx": {
@@ -401,7 +396,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 13
+ "count": 10
}
},
"client/src/components/Chat/Messages/Content/Parts/Attachment.tsx": {
@@ -409,7 +404,7 @@
"count": 9
},
"shadcn/no-restyle": {
- "count": 6
+ "count": 3
}
},
"client/src/components/Chat/Messages/Content/Parts/BashCall.tsx": {
@@ -499,7 +494,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 17
+ "count": 16
},
"shadcn/require-static-classes": {
"count": 1
@@ -556,7 +551,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 5
+ "count": 2
}
},
"client/src/components/Chat/Messages/Content/ToolCallGroup.tsx": {
@@ -576,7 +571,7 @@
},
"client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx": {
"shadcn/no-restyle": {
- "count": 6
+ "count": 5
}
},
"client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx": {
@@ -614,7 +609,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 15
+ "count": 14
}
},
"client/src/components/Chat/Messages/Content/animate.tsx": {
@@ -669,7 +664,7 @@
},
"client/src/components/Chat/Messages/MinimalHoverButtons.tsx": {
"shadcn/no-restyle": {
- "count": 9
+ "count": 8
},
"shadcn/require-static-classes": {
"count": 1
@@ -687,7 +682,7 @@
},
"client/src/components/Chat/Messages/SiblingSwitch.tsx": {
"shadcn/no-restyle": {
- "count": 16
+ "count": 14
}
},
"client/src/components/Chat/Messages/styles.ts": {