{
+ if (!open) closeViewer()
+ }}
+ >
+
+ {
+ event.preventDefault()
+ triggerRef.current?.focus()
+ }}
// Keep preview gestures from starting an ancestor's attachment drag.
onPointerDown={stopEvent}
+ // Portaled DOM events still follow React's logical tree. Stop
+ // clicks so viewer controls cannot activate an enclosing link.
+ onClick={stopEvent}
>
+ {activePreview.label}
-
- ) : null}
+
+
+
>
)
}
diff --git a/web/src/components/MarkdownRenderer.file-base.test.tsx b/web/src/components/MarkdownRenderer.file-base.test.tsx
index fd055a24..61ba2f7c 100644
--- a/web/src/components/MarkdownRenderer.file-base.test.tsx
+++ b/web/src/components/MarkdownRenderer.file-base.test.tsx
@@ -16,6 +16,7 @@ const listSessionDirectory = vi.hoisted(() => vi.fn(async () => ({
vi.mock('@tanstack/react-router', () => ({
useNavigate: () => vi.fn(),
+ useRouter: () => undefined,
}))
vi.mock('@/lib/app-context', () => ({
@@ -31,12 +32,12 @@ const markdown = [
'',
].join('\n\n')
-function renderPreview(filePath: string, workspacePath: string | null = null, fileSearch = {}) {
+function renderPreview(filePath: string, workspacePath: string | null = null, fileSearch = {}, content = markdown) {
return render(