Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(kanban): the card modal gets the ⌘M view (board parity)

reviewf0e117875a2a
diff --git a/CLAUDE.md b/CLAUDE.md
index cbf5963ff..306be5fe1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4748,9 +4748,18 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
cards edit their text in the modal (live both ways).
The modal header carries the terminal node's actions (search via `useTerminalSearch`+
`FindBar` on the modal xterm; dictate via the same `nodeterm:dictate` event — `.dictation`
- overlay z is 60, ABOVE the modal scrim; ✦ `pty.generateName` through the modal rename funnel).
+ overlay z is 60, ABOVE the modal scrim; ✦ `pty.generateName` through the modal rename funnel;
+ and the **⌘M view** — a header toggle (`IconMarkdown`) plus the chord, which lays the SAME face
+ the canvas node shows over the live viewer: `ChatPanel` when `canChat(created agent)` and the
+ session id is known, else `TerminalMarkdownView`. Three rules: the state is MODAL-LOCAL, keyed by
+ node id (never `data.mdMode` — that would flip the canvas node under the board too); the viewer
+ stays MOUNTED underneath (covered, not swapped, so its co-attach never detaches/re-attaches) and
+ gets the same focus hand-off as the node (`ModalTerminal`'s `covered` → `useMdModeFocus`); and the
+ chord reaches the modal through `window.nodeTerminal.onMarkdownToggle` only while it is the top
+ dialog, while the canvas node's own subscription refuses the chord whenever a board is up — a
+ hover flag can go stale under the opaque board, so one press could otherwise flip both).
**The 💬 icon means COMMENTS on both surfaces** (repurposed from the markdown view — ⌘M still
- toggles markdown/chat on the canvas node): on a terminal node it opens a right-side comments
+ toggles markdown/chat on the canvas node, and on the card modal): on a terminal node it opens a right-side comments
flyout (`.term-node__comments`, a sibling of the overflow:hidden root, hosting BoardLogPanel
with `card: Pick<KanbanSession,'id'>`); in the modal it collapses/reopens the panel, which is
OPEN BY DEFAULT there. Under the modal header sits the **card metadata strip** (`CardMetaBar.tsx`): Members (assign) —
diff --git a/src/renderer/components/kanban/CardModal.test.tsx b/src/renderer/components/kanban/CardModal.test.tsx
index 92d0d64d8..7eba307de 100644
--- a/src/renderer/components/kanban/CardModal.test.tsx
+++ b/src/renderer/components/kanban/CardModal.test.tsx
@@ -4,6 +4,9 @@ import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ProjectKanban } from '@shared/types'
import { pushDialog, popDialog, resetDialogStack } from '../dialog-stack'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { useAgentStatus } from '../../state/agentStatus'
import { CardModal } from './CardModal'
import type { KanbanSession } from './KanbanView'
@@ -29,12 +32,45 @@ vi.mock('../ContextMeter', () => ({
ContextMeter: () => null
}))
-// Mock ModalTerminal and BrowserSurface to keep tests lightweight and focused on CardModal
-vi.mock('./ModalTerminal', () => ({
- ModalTerminal: ({ nodeId }: { nodeId: string }) => (
- <div className="kanban-modal__term" data-node-id={nodeId} tabIndex={0}>
- Terminal Mock
- </div>
+// Mock ModalTerminal and BrowserSurface to keep tests lightweight and focused on CardModal.
+// The terminal mock counts its MOUNTS and exposes `covered`, so the ⌘M tests can prove the live
+// viewer stays mounted (never unmounted/remounted) while the view is laid over it.
+const termMock = vi.hoisted(() => ({ mounts: 0, unmounts: 0 }))
+vi.mock('./ModalTerminal', async () => {
+ const { useEffect } = await import('react')
+ return {
+ ModalTerminal: ({ nodeId, covered }: { nodeId: string; covered?: boolean }) => {
+ useEffect(() => {
+ termMock.mounts++
+ return () => {
+ termMock.unmounts++
+ }
+ }, [])
+ return (
+ <div className="kanban-modal__term" data-node-id={nodeId} data-covered={String(!!covered)} tabIndex={0}>
+ Terminal Mock
+ </div>
+ )
+ }
+ }
+})
+
+// The two ⌘M faces, stubbed to record the props they are handed.
+vi.mock('../../nodes/TerminalMarkdownView', () => ({
+ TerminalMarkdownView: ({ nodeId, hint }: { nodeId: string; hint: string }) => (
+ <div className="md-view-mock" data-node-id={nodeId} data-hint={hint} />
+ )
+}))
+vi.mock('../../nodes/ChatPanel', () => ({
+ ChatPanel: (p: { nodeId: string; sessionId?: string; cwd?: string; accountId?: string; agentId: string }) => (
+ <div
+ className="chat-panel-mock"
+ data-node-id={p.nodeId}
+ data-session-id={p.sessionId}
+ data-cwd={p.cwd}
+ data-account-id={p.accountId ?? ''}
+ data-agent-id={p.agentId}
+ />
)
}))
@@ -53,11 +89,22 @@ const board: ProjectKanban = {
assignments: []
}
+/** Subscribers of the ⌘M chord (window.nodeTerminal.onMarkdownToggle), fired by `pressCmdM`. */
+const mdToggleSubs = new Set<() => void>()
+const pressCmdM = () => act(() => mdToggleSubs.forEach((cb) => cb()))
+
describe('CardModal', () => {
let host: HTMLDivElement
beforeEach(() => {
resetDialogStack()
+ mdToggleSubs.clear()
+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {
+ onMarkdownToggle: (cb: () => void) => {
+ mdToggleSubs.add(cb)
+ return () => mdToggleSubs.delete(cb)
+ }
+ }
host = document.createElement('div')
document.body.append(host)
})
@@ -467,4 +514,138 @@ describe('CardModal', () => {
act(() => root.unmount())
})
+
+ describe('⌘M view (board parity with the canvas node)', () => {
+ const termSession = (over: Partial<KanbanSession> = {}): KanbanSession => ({
+ id: 'node-md-1',
+ title: 'Agent',
+ color: '#0a84ff',
+ kind: 'terminal',
+ agentId: 'claude',
+ spawn: { cwd: '/work/repo', agentId: 'claude' },
+ ...over
+ })
+
+ const render = (root: ReturnType<typeof createRoot>, session: KanbanSession) =>
+ act(() =>
+ root.render(
+ <CardModal
+ session={session}
+ columnTitle="To Do"
+ board={board}
+ onChangeBoard={vi.fn()}
+ onClose={vi.fn()}
+ onOpenCanvas={vi.fn()}
+ onRename={vi.fn()}
+ onEditSticky={vi.fn()}
+ onSetIcon={vi.fn()}
+ onBrowserNav={vi.fn()}
+ />
+ )
+ )
+ const toggle = () => document.body.querySelector<HTMLButtonElement>('button[aria-label="Markdown view"]')!
+ /** Let the lazily imported ChatPanel resolve. */
+ const settle = async () => {
+ for (let i = 0; i < 5; i++) await act(async () => { await new Promise((r) => setTimeout(r, 0)) })
+ }
+
+ beforeEach(() => {
+ termMock.mounts = 0
+ termMock.unmounts = 0
+ useAgentStatus.setState({ byId: {} } as never)
+ })
+
+ it('the header toggle lays the OUTPUT view over the live terminal, which stays mounted', () => {
+ const root = createRoot(host)
+ render(root, termSession({ agentId: undefined, spawn: { cwd: '/w' } }))
+ expect(termMock.mounts).toBe(1)
+ act(() => toggle().click())
+ const md = document.body.querySelector<HTMLElement>('.md-view-mock')!
+ expect(md.dataset.nodeId).toBe('node-md-1')
+ expect(document.body.querySelector('.kanban-modal__term')!.getAttribute('data-covered')).toBe('true')
+ act(() => toggle().click())
+ expect(document.body.querySelector('.md-view-mock')).toBeNull()
+ expect(document.body.querySelector('.kanban-modal__term')!.getAttribute('data-covered')).toBe('false')
+ expect(termMock.mounts).toBe(1)
+ expect(termMock.unmounts).toBe(0)
+ act(() => root.unmount())
+ })
+
+ it('a chat-capable agent with a known session gets ChatPanel with the node\'s props', async () => {
+ useAgentStatus.setState({ byId: { 'node-md-1': { sessionId: 'sess-42' } } } as never)
+ const root = createRoot(host)
+ render(root, termSession())
+ act(() => toggle().click())
+ await settle()
+ const chat = document.body.querySelector<HTMLElement>('.chat-panel-mock')!
+ expect(chat).toBeTruthy()
+ expect(chat.dataset.sessionId).toBe('sess-42')
+ expect(chat.dataset.agentId).toBe('claude')
+ expect(chat.dataset.cwd).toBe('/work/repo')
+ expect(chat.dataset.nodeId).toBe('node-md-1')
+ expect(document.body.querySelector('.md-view-mock')).toBeNull()
+ act(() => root.unmount())
+ })
+
+ it('falls back to the output view while the session id is unknown', () => {
+ const root = createRoot(host)
+ render(root, termSession())
+ act(() => toggle().click())
+ expect(document.body.querySelector('.md-view-mock')).toBeTruthy()
+ expect(document.body.querySelector('.chat-panel-mock')).toBeNull()
+ act(() => root.unmount())
+ })
+
+ it('the ⌘M chord toggles the modal view while it is the top dialog, and only then', () => {
+ const root = createRoot(host)
+ render(root, termSession({ agentId: undefined, spawn: {} }))
+ pressCmdM()
+ expect(document.body.querySelector('.md-view-mock')).toBeTruthy()
+ pushDialog('another-dialog-on-top')
+ pressCmdM()
+ expect(document.body.querySelector('.md-view-mock')).toBeTruthy()
+ popDialog('another-dialog-on-top')
+ pressCmdM()
+ expect(document.body.querySelector('.md-view-mock')).toBeNull()
+ act(() => root.unmount())
+ })
+
+ it('never subscribes to the chord for a non-terminal card', () => {
+ const root = createRoot(host)
+ render(root, { id: 's', title: 'n', color: '#ffd60a', kind: 'sticky', text: 'n', spawn: {} })
+ expect(mdToggleSubs.size).toBe(0)
+ act(() => root.unmount())
+ })
+
+ it('the view is per card: switching cards does not carry it onto the next one', () => {
+ const root = createRoot(host)
+ render(root, termSession({ agentId: undefined, spawn: {} }))
+ act(() => toggle().click())
+ expect(document.body.querySelector('.md-view-mock')).toBeTruthy()
+ render(root, termSession({ id: 'node-md-2', agentId: undefined, spawn: {} }))
+ expect(document.body.querySelector('.md-view-mock')).toBeNull()
+ act(() => root.unmount())
+ })
+
+ it('search is disabled while the view covers the terminal it searches', () => {
+ const root = createRoot(host)
+ render(root, termSession({ agentId: undefined, spawn: {} }))
+ const search = () => document.body.querySelector<HTMLButtonElement>('button[aria-label="Search this terminal"]')!
+ expect(search().disabled).toBe(false)
+ act(() => toggle().click())
+ expect(search().disabled).toBe(true)
+ act(() => root.unmount())
+ })
+
+ it('the canvas node refuses the chord while a board is up (no double toggle under the modal)', () => {
+ // Source pin: TerminalNode is a 6000-line component that cannot be mounted here. Its hover
+ // flag can be stale under the opaque board, so the refusal must stay in its subscription.
+ const src = readFileSync(resolve(__dirname, '../../nodes/TerminalNode.tsx'), 'utf8').replace(/\r\n/g, '\n')
+ const at = src.indexOf('window.nodeTerminal.onMarkdownToggle(')
+ expect(at).toBeGreaterThan(0)
+ const body = src.slice(at, at + 400)
+ expect(body).toMatch(/isGlobalKanbanOpen\(\) \|\| isKanbanOpen\(/)
+ expect(body.indexOf('isGlobalKanbanOpen')).toBeLessThan(body.indexOf('updateNodeData'))
+ })
+ })
})
diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsx
index b6cbef528..0c49c4887 100644
--- a/src/renderer/components/kanban/CardModal.tsx
+++ b/src/renderer/components/kanban/CardModal.tsx
@@ -1,10 +1,11 @@
-import { useEffect, useRef, useState } from 'react'
+import { Suspense, lazy, useCallback, useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { isTopDialog, nextDialogId, popDialog, pushDialog } from '../dialog-stack'
import {
IconChat,
IconClose,
IconExternal,
+ IconMarkdown,
IconMaximize,
IconMic,
IconRestoreSize,
@@ -43,6 +44,15 @@ import { BrowserSurface } from '../../nodes/BrowserSurface'
import { BrowserDrivingIndicator } from '../../nodes/BrowserDrivingChip'
import { NoteMarkdown } from '../NoteMarkdown'
import { relativeTime } from '../../lib/relativeTime'
+import { TerminalMarkdownView } from '../../nodes/TerminalMarkdownView'
+import { canChat } from '@shared/agents/config'
+import { effectiveAccountId } from '../../lib/accountChip'
+import { useSettings } from '../../state/settings'
+import { chipFor, commandTooltip } from '../../lib/keybindingOverrides'
+
+// Code-split exactly like the canvas node's: ChatPanel carries the markdown renderer, and the
+// card modal must not pull it onto the board's first paint.
+const ChatPanel = lazy(() => import('../../nodes/ChatPanel').then((m) => ({ default: m.ChatPanel })))
interface CardModalProps {
session: KanbanSession
@@ -66,7 +76,8 @@ interface CardModalProps {
/** Trello-style card popup over the board. Scrim click / Esc close it; the board (and the
* canvas under it) stay mounted. Terminal cards carry the node header's actions too:
- * search / dictate / AI-name / markdown view (the node itself is hidden under the board). */
+ * search / dictate / AI-name / the ⌘M view — ChatPanel or the output markdown, the same face the
+ * canvas node shows (the node itself is hidden under the board). */
export function CardModal({ session, columnTitle, board, onChangeBoard, onClose, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon }: CardModalProps) {
const { api } = useSession()
const idRef = useRef<string>()
@@ -94,6 +105,34 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,
const isTerminal = session.kind === 'terminal'
const isBrowser = session.kind === 'browser'
+ // ── The ⌘M view (board parity with the canvas node's markdown / chat face) ─────────────────
+ // MODAL-LOCAL on purpose, never `data.mdMode`: flipping the node's flag would also flip the
+ // canvas node under the board. Keyed by node id (this component is not remounted per card, so
+ // a bare boolean would carry the open view onto the next card the user opens).
+ const [mdFor, setMdFor] = useState<string | null>(null)
+ const mdOpen = isTerminal && mdFor === session.id
+ const toggleMd = useCallback(() => {
+ setMdFor((cur) => (cur === session.id ? null : session.id))
+ setSearchOpen(false) // the FindBar searches the xterm the view now covers
+ }, [session.id])
+ // Same decision the node makes (TerminalNode: `showChat` / `useChat`): the CREATED agent picks
+ // the reader, ChatPanel only once the session id is known, else the output view.
+ const createdAgent = session.agentId ?? session.spawn.agentId
+ const claudeAccounts = useSettings((s) => s.settings.claudeAccounts)
+ const accountForReads = effectiveAccountId(session.spawn.accountId, observedAccount, claudeAccounts)
+ const useChat = mdOpen && !!createdAgent && canChat(createdAgent) && !!agentSessionId
+ const captureFull = useCallback((nodeId: string) => api.pty.capture(nodeId, true), [api])
+ const mdChip = chipFor('node.toggleMarkdown')
+ // The chord (main-intercepted on desktop, bridged in the browser) toggles THIS view while the
+ // modal is the top dialog. The canvas node under the board refuses the same chord while a board
+ // is up (TerminalNode), so one press can never flip both.
+ useEffect(() => {
+ if (!isTerminal) return
+ return window.nodeTerminal.onMarkdownToggle(() => {
+ if (isTopDialog(id)) toggleMd()
+ })
+ }, [id, isTerminal, toggleMd])
+
// ── Resizable / maximizable sheet (issue #389) ──────────────────────────────────────────────
// The sheet stays CENTRED; resize is symmetric about the centre, so every edge/corner handle
// tracks the cursor 1:1 with `Δsize = 2·Δcursor` and we never manage a left/top. Size (and the
@@ -331,8 +370,19 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,
<ContextMeter sessionId={agentSessionId ?? null} nodeId={session.id} remote={isRemoteSessionNode(session.spawn)} agentId={session.agentId ?? session.spawn.agentId ?? observedAgentId} />
<button
className="kanban-modal__action"
- title="Search this terminal"
+ title={commandTooltip(mdOpen ? 'Back to the live terminal' : 'Markdown / chat view', 'node.toggleMarkdown')}
+ aria-label="Markdown view"
+ aria-pressed={mdOpen}
+ onClick={toggleMd}
+ >
+ <IconMarkdown />
+ </button>
+ <button
+ className="kanban-modal__action"
+ title={mdOpen ? 'Search works on the live terminal — leave the markdown view first' : 'Search this terminal'}
+ aria-label="Search this terminal"
aria-pressed={searchOpen}
+ disabled={mdOpen}
onClick={() => setSearchOpen((v) => !v)}
>
<IconSearch />
@@ -444,13 +494,39 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,
{session.kind === 'terminal' ? (
// A live SECOND client on the node's session — keyed by node id so switching cards
// remounts a fresh viewer.
- <ModalTerminal
- key={session.id}
- nodeId={session.id}
- spawn={session.spawn}
- searchOpen={searchOpen}
- onCloseSearch={() => setSearchOpen(false)}
- />
+ <>
+ <ModalTerminal
+ key={session.id}
+ nodeId={session.id}
+ spawn={session.spawn}
+ searchOpen={searchOpen}
+ onCloseSearch={() => setSearchOpen(false)}
+ covered={mdOpen}
+ />
+ {/* The ⌘M face is laid OVER the live viewer (the pane anchors it), never swapped
+ in for it: ModalTerminal stays mounted, so its co-attach does not detach and
+ re-attach — and its grid does not resize — every time the view flips. */}
+ {mdOpen &&
+ (useChat ? (
+ <Suspense fallback={null}>
+ <ChatPanel
+ key={session.id}
+ nodeId={session.id}
+ sessionId={agentSessionId}
+ cwd={session.spawn.cwd}
+ accountId={accountForReads}
+ agentId={createdAgent!}
+ />
+ </Suspense>
+ ) : (
+ <TerminalMarkdownView
+ key={session.id}
+ nodeId={session.id}
+ capture={captureFull}
+ hint={mdChip ? `${mdChip} to exit` : 'Exit'}
+ />
+ ))}
+ </>
) : isBrowser ? (
// A live browser webview seeded with the node's URL; navigation persists back to
// the node (the canvas node picks it up on its next mount).
diff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsx
index 16f619729..14c401494 100644
--- a/src/renderer/components/kanban/ModalTerminal.tsx
+++ b/src/renderer/components/kanban/ModalTerminal.tsx
@@ -14,6 +14,7 @@ import { effectiveAccountId } from '../../lib/accountChip'
import { readsClaudeTranscript } from '../../lib/transcriptGates'
import { liveProjectJumpTarget } from '../../lib/projectJump'
import { terminalChordBubbles, terminalShortcutPolicy } from '../../lib/keybindingOverrides'
+import { focusXtermUnlessCovered, useMdModeFocus } from '../../terminal/useMdModeFocus'
import { FindBar } from '../FindBar'
import { useAgentStatus } from '../../state/agentStatus'
import { useProjects } from '../../state/projects'
@@ -84,9 +85,17 @@ interface ModalTerminalProps {
/** The modal header's 🔍 toggle — the FindBar renders inside this pane. */
searchOpen: boolean
onCloseSearch: () => void
+ /**
+ * The card modal's ⌘M view (output markdown / ChatPanel) is laid OVER this viewer. It stays
+ * mounted underneath — its co-attach is a second pty client whose attach/detach is expensive and
+ * must not churn — so it only has to stop holding the keyboard: blur on cover, restore on uncover
+ * when it had focus, and never take focus while covered (the async attach below focuses on
+ * completion, which a quick ⌘M can precede). Same rules as the canvas node's ⌘M face.
+ */
+ covered?: boolean
}
-export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch }: ModalTerminalProps) {
+export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch, covered = false }: ModalTerminalProps) {
const { api } = useSession()
const hostRef = useRef<HTMLDivElement>(null)
const middleClickPaste = useSettings((st) => st.settings.terminalMiddleClickPaste)
@@ -101,6 +110,9 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch }: Moda
}, [middleClickPaste])
const termRef = useRef<Terminal | null>(null)
+ const coveredRef = useRef(covered)
+ coveredRef.current = covered
+ useMdModeFocus(covered, () => termRef.current, () => hostRef.current?.closest('.kanban-modal'))
const searchAddonRef = useRef<SearchAddon | null>(null)
// The live pty session + its fit addon, reachable from OUTSIDE the lifecycle effect's closure —
// the appearance effect below has to re-fit and re-REPORT this viewer's grid, and under co-attach
@@ -400,7 +412,7 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch }: Moda
ro.observe(hostRef.current!)
cleanups.push(() => ro.disconnect())
transport.resize(res.sessionId, term.cols, term.rows)
- term.focus()
+ focusXtermUnlessCovered(term, coveredRef.current)
})()
return () => {
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 2207e31e6..2cdfc9f61 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -5278,10 +5278,15 @@ export function TerminalNode({
}
}, [id, canReadTitleNode, status?.sessionId, data.titleAuto, updateNodeData])
- // Cmd/Ctrl+M toggles markdown view of this terminal's output (only when hovered).
+ // Cmd/Ctrl+M toggles markdown view of this terminal's output (only when hovered). NOT while a
+ // board covers the canvas: the kanban card modal owns the chord then (its own ⌘M view), and a
+ // hover flag can be stale under the opaque board — the pointer never "left" a node that was
+ // covered while hovered, so one press would flip the hidden node AND the modal.
useEffect(() => {
return window.nodeTerminal.onMarkdownToggle(() => {
- if (hoveredRef.current) updateNodeData(id, (n) => ({ mdMode: !n.data.mdMode }))
+ if (!hoveredRef.current) return
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId ?? '')) return
+ updateNodeData(id, (n) => ({ mdMode: !n.data.mdMode }))
})
}, [id, updateNodeData])
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 6109f10e7..15201c9e0 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -2995,6 +2995,13 @@ body,
color: var(--muted);
}
+/* The kanban card modal lays the same ⌘M face over its live viewer (the pane anchors it). Above
+ the viewer's own floating bits (FindBar, copy pill, upload note), which share that pane. */
+.kanban-modal__pane > .term-md,
+.kanban-modal__pane > .term-chat {
+ z-index: 20;
+}
+
.term-md__content {
flex: 1;
min-height: 0;
diff --git a/src/renderer/terminal/useMdModeFocus.test.tsx b/src/renderer/terminal/useMdModeFocus.test.tsx
index 0aca42b46..24a5a8ae1 100644
--- a/src/renderer/terminal/useMdModeFocus.test.tsx
+++ b/src/renderer/terminal/useMdModeFocus.test.tsx
@@ -161,4 +161,12 @@ describe('focusXtermUnlessCovered', () => {
expect(src).not.toMatch(/termRef\.current\?\.focus\(\)/)
expect(src.match(/focusXtermUnlessCovered\(termRef\.current, mdModeRef\.current\)/g)?.length).toBe(2)
})
+
+ it('the kanban card modal viewer uses the same hand-off (blur when covered, no attach-time focus)', () => {
+ // Source pin, same reason: ModalTerminal attaches asynchronously and focuses on completion,
+ // which a quick ⌘M in the card modal can precede — that focus must ask about the cover too.
+ const src = readFileSync(resolve(__dirname, '../components/kanban/ModalTerminal.tsx'), 'utf8').replace(/\r\n/g, '\n')
+ expect(src).toMatch(/useMdModeFocus\(covered,/)
+ expect(src).toMatch(/focusXtermUnlessCovered\(term, coveredRef\.current\)/)
+ })
})