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

🔅 style: Theme the Tool Approval Decision Fields (#16014)

lia-by-librechat[bot]cacc148795e5
diff --git a/client/src/components/Chat/Messages/Content/ToolApproval.tsx b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
index 61eb1840e4..359c190533 100644
--- a/client/src/components/Chat/Messages/Content/ToolApproval.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
@@ -33,6 +33,18 @@ const DECISION_LABEL: Record<DecisionType, TranslationKeys> = {
respond: 'com_ui_respond',
};
+/**
+ * Chrome shared by the three decision fields. `TextareaAutosize` renders a bare
+ * `textarea`, which preflight leaves at `color: inherit`, so a field that names
+ * no colour token draws the typed text in whatever colour it inherits — on the
+ * dark theme that was near-black over the `surface-primary` fill, about 1.1:1.
+ * The value and the placeholder each name their token, and the boundary is
+ * `border-xheavy` so the field reads as a control at WCAG 1.4.11's 3:1
+ * (`border-light` measures ~1.4:1 against this fill).
+ */
+const fieldClasses =
+ 'w-full resize-none rounded-md border border-border-xheavy bg-surface-primary p-2 text-text-primary placeholder:text-text-secondary';
+
/** Pretty-print tool args as JSON for the `edit` textarea seed. */
function seedArgs(args: string | Record<string, unknown> | undefined): string {
if (args == null) {
@@ -234,10 +246,7 @@ export default function ToolApproval({
onChange={(e) => updateDecisionDraft({ editText: e.target.value })}
minRows={3}
maxRows={16}
- className={cn(
- 'w-full resize-none rounded-md border bg-surface-primary p-2 font-mono text-xs',
- editIsValid ? 'border-border-light' : 'border-red-500',
- )}
+ className={cn(fieldClasses, 'font-mono text-xs', !editIsValid && 'border-red-500')}
aria-label={localize('com_ui_edit')}
/>
{!editIsValid && (
@@ -254,7 +263,7 @@ export default function ToolApproval({
minRows={2}
maxRows={12}
placeholder={localize('com_ui_tool_response_placeholder')}
- className="w-full resize-none rounded-md border border-border-light bg-surface-primary p-2 text-sm"
+ className={cn(fieldClasses, 'text-sm')}
aria-label={localize('com_ui_respond')}
/>
)}
@@ -267,7 +276,7 @@ export default function ToolApproval({
minRows={1}
maxRows={6}
placeholder={localize('com_ui_reject_reason_placeholder')}
- className="w-full resize-none rounded-md border border-border-light bg-surface-primary p-2 text-sm"
+ className={cn(fieldClasses, 'text-sm')}
aria-label={localize('com_ui_reject')}
/>
)}
diff --git a/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx
index cdf5c7992a..7066770ea0 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx
@@ -84,6 +84,41 @@ describe('ToolApproval', () => {
expect(submit).toBeEnabled();
});
+ test('every decision field names its own text, placeholder and border tokens', () => {
+ renderCards(
+ <ToolApproval
+ approval={approval(['approve', 'reject', 'edit', 'respond'])}
+ toolCallId="call-1"
+ args={{ a: 1 }}
+ />,
+ );
+
+ for (const decision of ['Reject', 'Respond', 'Edit'] as const) {
+ const toggle = screen.getByRole('button', { name: decision });
+ fireEvent.click(toggle);
+ const field = screen.getByRole('textbox', { name: decision });
+ // A bare `textarea` inherits its colour, so the tokens have to be named here.
+ expect(field).toHaveClass('text-text-primary');
+ expect(field).toHaveClass('border-border-xheavy');
+ if (decision !== 'Edit') {
+ expect(field).toHaveClass('placeholder:text-text-secondary');
+ }
+ fireEvent.click(toggle);
+ }
+ });
+
+ test('invalid edit JSON replaces the field border rather than doubling it', () => {
+ renderCards(<ToolApproval approval={approval(['edit'])} toolCallId="call-1" args={{ a: 1 }} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Edit' }));
+ const field = screen.getByRole('textbox', { name: 'Edit' });
+ fireEvent.change(field, { target: { value: '{' } });
+
+ expect(field).toHaveClass('border-red-500');
+ expect(field).not.toHaveClass('border-border-xheavy');
+ expect(screen.getByText('Invalid JSON')).toBeInTheDocument();
+ });
+
test('multiple paused calls share one Submit that requires every decision', () => {
renderCards(
<>