From fdef598853d2f119f3463befd44dfc2fa560295d Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Tue, 29 Sep 2026 22:23:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=BD=20fix:=20Paint=20Freed=20Feature?= =?UTF-8?q?=20Surfaces=20From=20Theme=20Roles=20(#16517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Paint Tool Output Panes With the Code Body Role The output panes of code execution, file authoring and file reads painted surface-chat in light and surface-primary-alt in dark. surface-code-body is that same pair in the default, dark and high-contrast themes, and a theme that styles its code blocks now styles these panes with them. * fix: Draw the MCP OAuth Logo and QR Tiles From Fixed Roles The server logo tile and the QR backdrop were bg-white. They take surface-fixed and surface-qr, both white in every bundled theme, so a theme can own them without the QR losing its quiet zone. * fix: Give TextareaAutosize an Invalid State and Use It for Tool Arguments The tool-approval edit field flagged invalid JSON with border-red-500, a raw colour the primitive's owner rule rejects in any semantic form. TextareaAutosize now draws its border in border-destructive when aria-invalid is set, the attribute the Skills description fields already pass. ToolApproval sets aria-invalid and points aria-describedby at the Invalid JSON message, so a screen reader announces the error as well. * docs: Record the Image Preview, Artifact Scrollbar and Azure Chip Colours Adds the image preview's media overlays, the sandboxed artifact document's scrollbar and the Azure file-source gradient to the theme allowlist. * test: Cover the Tool Output Pane, Invalid Tool Arguments and OAuth QR Tile Scenarios for the code-body pane behind a file-authoring card, the announced invalid state of the tool-approval edit field, and the MCP OAuth QR backdrop staying white in both modes. * test: Retry the Output Pane Colour and Set Up the Approval and OAuth Scenarios at Desktop Size The pane is read with a retrying assertion against the resolved role, since the card re-renders as highlighting lands. The approval agent and the MCP Settings panel are reached through side panels the mobile layout keeps in its drawer, so those two scenarios run at desktop size on the mobile project. (cherry picked from commit 2f16e6b37b711ccdaff5a66276d7e87df2ae0235) Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16517 --- .../Messages/Content/Parts/ExecuteCode.tsx | 2 +- .../Content/Parts/FileAuthoringCall.tsx | 2 +- .../Messages/Content/Parts/ReadFileCall.tsx | 2 +- .../Chat/Messages/Content/ToolApproval.tsx | 21 ++- .../Content/__tests__/ToolApproval.test.tsx | 7 +- client/src/components/MCP/McpOAuthDialog.tsx | 4 +- .../mock/scenarios/mcp-oauth-tiles.spec.ts | 88 +++++++++++++ .../tool-approval-invalid-json.spec.ts | 121 ++++++++++++++++++ .../mock/scenarios/tool-output-pane.spec.ts | 69 ++++++++++ eslint-suppressions.json | 5 +- .../src/components/TextareaAutosize.tsx | 7 +- packages/client/src/theme/allowlist.md | 3 + 12 files changed, 310 insertions(+), 21 deletions(-) create mode 100644 e2e/specs/mock/scenarios/mcp-oauth-tiles.spec.ts create mode 100644 e2e/specs/mock/scenarios/tool-approval-invalid-json.spec.ts create mode 100644 e2e/specs/mock/scenarios/tool-output-pane.spec.ts diff --git a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx index 6c85dc0f63..8d438e9e87 100644 --- a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx @@ -185,7 +185,7 @@ export default function ExecuteCode({
{highlighted ?? code}
diff --git a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
index 549bbd5970..72b33dae48 100644
--- a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
@@ -249,7 +249,7 @@ export default function FileAuthoringCall({
{highlighted ?? preview}
diff --git a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
index 23a9cdd00f..70a8ed104d 100644
--- a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
@@ -141,7 +141,7 @@ export default function ReadFileCall({
)}
>
-
+
{highlighted ?? output}
diff --git a/client/src/components/Chat/Messages/Content/ToolApproval.tsx b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
index a75d05ecdf..cce54f4d30 100644
--- a/client/src/components/Chat/Messages/Content/ToolApproval.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
@@ -1,4 +1,4 @@
-import { useContext, useEffect, useMemo } from 'react';
+import { useId, useEffect, useMemo } from 'react';
import { Button, TextareaAutosize } from '@librechat/client';
import { Check, X, Pencil, MessageSquare, ShieldQuestion, TriangleAlert } from 'lucide-react';
import type { Agents } from 'librechat-data-provider';
@@ -89,6 +89,7 @@ export default function ToolApproval({
surface?: 'thread' | 'composer';
}) {
const localize = useLocalize();
+ const invalidJsonId = useId();
const { actionId, allowed_decisions: allowedDecisions, description } = approval;
const conversationId = useContext(ChatContext)?.conversation?.conversationId;
const composerPresents = useComposerPresentsApproval(conversationId, actionId);
@@ -239,11 +240,13 @@ export default function ToolApproval({
return (
- {descriptionNode}
+ {safeDescription != null && safeDescription.length > 0 && (
+ {safeDescription}
+ )}
{allowedDecisions.map((decision) => {
const Icon = DECISION_ICON[decision];
@@ -272,11 +275,15 @@ export default function ToolApproval({
onChange={(e) => updateDecisionDraft({ editText: e.target.value })}
minRows={3}
maxRows={16}
- className={cn(fieldClasses, 'font-mono text-xs', !editIsValid && 'border-red-500')}
+ className={cn(fieldClasses, 'font-mono text-xs')}
aria-label={localize('com_ui_edit')}
+ aria-invalid={!editIsValid}
+ aria-describedby={editIsValid ? undefined : invalidJsonId}
/>
{!editIsValid && (
- {localize('com_ui_invalid_json')}
+
+ {localize('com_ui_invalid_json')}
+
)}
)}
@@ -318,13 +325,13 @@ export default function ToolApproval({
{submitLabel}
{status === 'expired' && (
-
+
{localize('com_ui_approval_expired')}
)}
{status === 'error' && (
-
+
{localize('com_ui_approval_error')}
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 7938114a31..45f60ff99b 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/ToolApproval.test.tsx
@@ -114,16 +114,15 @@ describe('ToolApproval', () => {
}
});
- test('invalid edit JSON replaces the field border rather than doubling it', () => {
+ test('invalid edit JSON marks the field invalid and names the error', () => {
renderCards( );
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();
+ expect(field).toHaveAttribute('aria-invalid', 'true');
+ expect(field).toHaveAccessibleDescription('Invalid JSON');
});
test('multiple paused calls share one Submit that requires every decision', () => {
diff --git a/client/src/components/MCP/McpOAuthDialog.tsx b/client/src/components/MCP/McpOAuthDialog.tsx
index 45049ab67c..7102829190 100644
--- a/client/src/components/MCP/McpOAuthDialog.tsx
+++ b/client/src/components/MCP/McpOAuthDialog.tsx
@@ -52,7 +52,7 @@ export default function McpOAuthDialog({
{iconUrl && !iconError && (