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

🐛 fix: Keep Artifact Download Clear of Message Navigation (#17079)

Dustin Healy60a8b3dec083
diff --git a/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx b/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
index d52898d9a6..9f04e7123e 100644
--- a/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx
@@ -10,8 +10,8 @@ import {
Workflow,
} from 'lucide-react';
import type { ArtifactGlyph, ArtifactRowKind } from '~/utils/artifacts';
+import { ARTIFACT_ROW_NAV_SPACING, ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from '../rows';
import LangIcon, { hasLangIcon } from '~/components/Messages/Content/LangIcon';
-import { ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from '../rows';
import { useLocalize } from '~/hooks';
import { cn } from '~/utils';
@@ -79,7 +79,7 @@ const ArtifactRow = forwardRef<HTMLButtonElement, ArtifactRowProps>(function Art
}
return (
- <div className={cn(TOOL_ROW_CLASSES, 'text-text-secondary text-sm')}>
+ <div className={cn(TOOL_ROW_CLASSES, 'text-text-secondary text-sm', ARTIFACT_ROW_NAV_SPACING)}>
<Button
ref={ref}
type="button"
diff --git a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
index a6c1c1b945..ec4a1246f8 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
@@ -14,11 +14,11 @@ import {
isTextAttachment,
renderAttachmentKey,
} from './attachmentTypes';
+import { ARTIFACT_ROW_NAV_SPACING, ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from '../rows';
import { useLocalize, useAttachmentPreviewSync, useExpandCollapse } from '~/hooks';
import FileContainer from '~/components/Chat/Input/Files/FileContainer';
import { fileToArtifact, TOOL_ARTIFACT_TYPES } from '~/utils/artifacts';
import Image from '~/components/Chat/Messages/Content/Image';
-import { ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from '../rows';
import ToolMermaidArtifact from './ToolMermaidArtifact';
import ToolArtifactCard from './ToolArtifactCard';
import { useAttachmentLink } from './LogLink';
@@ -64,7 +64,9 @@ const PreviewPlaceholderRow = memo(
? localize('com_ui_preview_preparing')
: localize('com_ui_preview_failed');
return (
- <div className={cn(TOOL_ROW_CLASSES, 'text-text-secondary text-sm')}>
+ <div
+ className={cn(TOOL_ROW_CLASSES, ARTIFACT_ROW_NAV_SPACING, 'text-text-secondary text-sm')}
+ >
<span className={ROW_GLYPH_SLOT} aria-hidden="true">
{status === 'pending' ? (
<Loader2 className="size-4 shrink-0 animate-spin" />
@@ -132,7 +134,7 @@ const FileAttachment = memo(({ attachment }: { attachment: Partial<TAttachment>
return (
<div
className={cn(
- 'subpixel-antialiased transition-all duration-300 ease-out',
+ 'w-full min-w-0 subpixel-antialiased transition-all duration-300 ease-out',
isVisible ? 'translate-y-0 opacity-100' : 'translate-y-2 opacity-0',
)}
style={{
diff --git a/client/src/components/Chat/Messages/Content/rows.ts b/client/src/components/Chat/Messages/Content/rows.ts
index 38e58263a1..b535369d69 100644
--- a/client/src/components/Chat/Messages/Content/rows.ts
+++ b/client/src/components/Chat/Messages/Content/rows.ts
@@ -7,6 +7,9 @@
*/
export const TOOL_ROW_CLASSES = 'relative my-1.5 flex h-5 shrink-0 items-center gap-2.5';
+/** Leave an 8px gap beside MessageNav's hit area in full-width chat. */
+export const ARTIFACT_ROW_NAV_SPACING = 'pr-3 md:pr-17';
+
/** Behavior hook for header glyphs, independent of their layout. */
export const FOLD_GLYPH_CLASS = 'fold-glyph';
diff --git a/e2e/specs/mock/scenarios/artifact-download-message-nav.spec.ts b/e2e/specs/mock/scenarios/artifact-download-message-nav.spec.ts
new file mode 100644
index 0000000000..7eef805e0d
--- /dev/null
+++ b/e2e/specs/mock/scenarios/artifact-download-message-nav.spec.ts
@@ -0,0 +1,166 @@
+import { expect, test } from '@playwright/test';
+
+const NO_PARENT = '00000000-0000-0000-0000-000000000000';
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+test('artifact downloads stay clickable beneath the message navigation rail across preview states and chat widths @scenario:artifact-download-clears-message-nav', async ({
+ page,
+}) => {
+ await page.goto('/');
+ for (const status of ['ready', 'pending', 'failed'] as const) {
+ for (const fullWidth of [false, true]) {
+ await page.evaluate((value) => {
+ localStorage.setItem('maximizeChatSpace', JSON.stringify(value));
+ }, fullWidth);
+ const conversationId = `artifact-nav-${Date.now()}-${status}-${fullWidth}`;
+ const filename = `workbook-${'x'.repeat(100)}.xlsx`;
+ const fileId = `${conversationId}-file`;
+ const toolCallId = `${conversationId}-tool`;
+ const now = new Date(0).toISOString();
+ const base = { conversationId, createdAt: now, updatedAt: now };
+ const messages = [
+ {
+ ...base,
+ messageId: `${conversationId}-user-1`,
+ parentMessageId: NO_PARENT,
+ isCreatedByUser: true,
+ sender: 'User',
+ text: 'Create a workbook.',
+ },
+ {
+ ...base,
+ messageId: `${conversationId}-assistant-1`,
+ parentMessageId: `${conversationId}-user-1`,
+ isCreatedByUser: false,
+ sender: 'Assistant',
+ endpoint: 'Mock Provider A',
+ model: 'mock-model-a',
+ text: 'I will prepare it.',
+ },
+ {
+ ...base,
+ messageId: `${conversationId}-user-2`,
+ parentMessageId: `${conversationId}-assistant-1`,
+ isCreatedByUser: true,
+ sender: 'User',
+ text: 'Finish the spreadsheet.',
+ },
+ {
+ ...base,
+ messageId: `${conversationId}-assistant-2`,
+ parentMessageId: `${conversationId}-user-2`,
+ isCreatedByUser: false,
+ sender: 'Assistant',
+ endpoint: 'Mock Provider A',
+ model: 'mock-model-a',
+ text: '',
+ content: [
+ {
+ type: 'tool_call',
+ tool_call: {
+ id: toolCallId,
+ name: 'execute_code',
+ args: '{}',
+ output: 'done',
+ progress: 1,
+ },
+ },
+ {
+ type: 'text',
+ text: Array.from({ length: 80 }, (_, i) => `Analysis line ${i + 1}.`).join('\n\n'),
+ },
+ ],
+ attachments: [
+ {
+ file_id: fileId,
+ filename,
+ filepath: `/api/files/code/download/test-session/${fileId}`,
+ type: 'execute_code',
+ source: 'local',
+ bytes: 2048,
+ messageId: `${conversationId}-assistant-2`,
+ conversationId,
+ toolCallId,
+ status,
+ text: status === 'ready' ? '<table><tr><td>ready</td></tr></table>' : undefined,
+ textFormat: status === 'ready' ? 'html' : undefined,
+ },
+ ],
+ },
+ ];
+ const conversation = {
+ ...base,
+ title: 'Artifact navigation overlap',
+ endpoint: 'Mock Provider A',
+ endpointType: 'custom',
+ model: 'mock-model-a',
+ };
+ await page.route(`**/api/convos/${conversationId}*`, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(conversation),
+ }),
+ );
+ await page.route(`**/api/messages/${conversationId}*`, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(messages),
+ }),
+ );
+ let downloadRequests = 0;
+ await page.route('**/api/files/code/download/test-session/**', (route) => {
+ downloadRequests += 1;
+ return route.fulfill({ status: 200, body: 'workbook bytes' });
+ });
+
+ await page.goto(`/c/${conversationId}`);
+ const download = page.getByRole('button', { name: `Download ${filename}` });
+ await expect(download).toBeVisible();
+ const nav = page.locator('nav[aria-keyshortcuts="Shift+Alt+M"]');
+ await expect(nav).toBeVisible();
+ if (fullWidth) {
+ await expect(page.locator('.message-render').filter({ has: download })).toHaveClass(
+ /max-w-full/,
+ );
+ }
+ await download.scrollIntoViewIfNeeded();
+ await download.evaluate((el) => {
+ const rail = document.querySelector('nav[aria-keyshortcuts="Shift+Alt+M"]');
+ if (!rail) {
+ throw new Error('Message navigation rail is missing');
+ }
+ const railBox = rail.getBoundingClientRect();
+ const targetY = railBox.top + railBox.height / 2;
+ let scroller = el.parentElement;
+ while (
+ scroller &&
+ !(
+ scroller.scrollHeight > scroller.clientHeight + 10 &&
+ /auto|scroll/.test(getComputedStyle(scroller).overflowY)
+ )
+ ) {
+ scroller = scroller.parentElement;
+ }
+ if (!scroller) {
+ throw new Error('Message scroller is missing');
+ }
+ const box = el.getBoundingClientRect();
+ scroller.scrollTop += box.top + box.height / 2 - targetY;
+ });
+
+ const box = await download.boundingBox();
+ const railBox = await nav.boundingBox();
+ expect(box).not.toBeNull();
+ expect(railBox).not.toBeNull();
+ const center = { x: box!.x + box!.width / 2, y: box!.y + box!.height / 2 };
+ expect(center.y).toBeGreaterThan(railBox!.y);
+ expect(center.y).toBeLessThan(railBox!.y + railBox!.height);
+ expect(box!.x + box!.width).toBeLessThanOrEqual(railBox!.x - 7);
+ await page.mouse.click(center.x, center.y);
+ await expect.poll(() => downloadRequests).toBe(1);
+ }
+ }
+});