Preflight Checklist
What's Wrong?
The preview_screenshot MCP tool reliably times out (30-second timeout) whenever the Claude Code Desktop preview pane is not the foreground window. This makes autonomous visual verification essentially broken — agents call preview_screenshot during their work, at which point the user is reading the chat response and the preview pane is in the background.
This is a Claude Code Desktop issue, not a user app issue. The preview pane BrowserWindow/WebContentsView is created and managed entirely by Claude Code Desktop. Users have no access to how it is instantiated and cannot fix it themselves.
Investigation via preview_eval confirmed the root cause:
document.visibilityState === "hidden" throughout all testing while chat pane is focused
performance.getEntriesByType('paint').length === 0 — compositor has never painted
requestAnimationFrame callbacks never fire while hidden
We exhaustively confirmed that no JavaScript running inside the preview page can work around this — the following were all tried and failed to trigger a compositor paint:
Object.defineProperty(document, 'visibilityState', { get: () => 'visible' })
- Overriding
requestAnimationFrame to use setTimeout
window.focus(), document.documentElement.focus()
Element.requestFullscreen()
- Continuous DOM mutations, forced scrolls, injecting large elements
The fix must be made in Claude Code Desktop's Electron layer — specifically in how the preview BrowserWindow/WebContentsView is created. Users cannot work around this.
What Should Happen?
preview_screenshot should capture the current rendered state of the preview pane regardless of which panel is focused in Claude Code Desktop. The pane is visually rendering content on screen — only the MCP screenshot capture fails.
Error Messages/Logs
Steps to Reproduce
- Start a dev server with
preview_start
- Read Claude's response in the chat pane (preview pane moves to background)
- Claude calls
preview_screenshot autonomously
- Tool times out after 30 seconds — every time, with no useful error
Alternatively, verify the root cause directly:
- Start a dev server with
preview_start
- Run
preview_eval with expression document.visibilityState while reading chat
- Returns
"hidden" — confirms compositor is not painting the preview pane
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
Claude Code Desktop: Claude/1.4758.0
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Environment:
- Claude Code Desktop: Claude/1.4758.0
- Electron: 41.3.0
- Chromium: 146.0.7680.188
- OS: Windows 11
Why users cannot fix this themselves:
The preview pane is a BrowserWindow or WebContentsView created internally by Claude Code Desktop. Users have no access to the Electron layer, no ability to pass window creation options, and no way to inject Chrome flags into that specific window. Every JS-level workaround was tested and failed — the compositor simply does not paint hidden windows regardless of what the page JavaScript does.
Suggested fix (one of the following, applied in Claude Code Desktop's Electron code):
- Set
paintWhenInitiallyHidden: true on the preview BrowserWindow/WebContentsView
- Add
--disable-renderer-backgrounding Chrome flag to the preview window
- Add
--disable-backgrounding-occluded-windows Chrome flag
- Add
--disable-features=CalculateNativeWinOcclusion Chrome flag
Note: When the preview pane IS the foreground window, visibilityState is "visible" and preview_screenshot works correctly. This confirms the pane renders fine — only the backgrounding behaviour needs to be disabled.
Impact:
- Every
preview_screenshot call during autonomous agent work times out (30 seconds each)
- Agents typically retry multiple times, wasting minutes per session
- Visual verification of UI changes is effectively unavailable during agentic workflows
- Workaround (Claude in Chrome MCP) requires the user to have Chrome extension installed and adds unnecessary complexity to what should be a simple screenshot
Preflight Checklist
What's Wrong?
The
preview_screenshotMCP tool reliably times out (30-second timeout) whenever the Claude Code Desktop preview pane is not the foreground window. This makes autonomous visual verification essentially broken — agents callpreview_screenshotduring their work, at which point the user is reading the chat response and the preview pane is in the background.This is a Claude Code Desktop issue, not a user app issue. The preview pane BrowserWindow/WebContentsView is created and managed entirely by Claude Code Desktop. Users have no access to how it is instantiated and cannot fix it themselves.
Investigation via
preview_evalconfirmed the root cause:document.visibilityState === "hidden"throughout all testing while chat pane is focusedperformance.getEntriesByType('paint').length === 0— compositor has never paintedrequestAnimationFramecallbacks never fire while hiddenWe exhaustively confirmed that no JavaScript running inside the preview page can work around this — the following were all tried and failed to trigger a compositor paint:
Object.defineProperty(document, 'visibilityState', { get: () => 'visible' })requestAnimationFrameto usesetTimeoutwindow.focus(),document.documentElement.focus()Element.requestFullscreen()The fix must be made in Claude Code Desktop's Electron layer — specifically in how the preview BrowserWindow/WebContentsView is created. Users cannot work around this.
What Should Happen?
preview_screenshotshould capture the current rendered state of the preview pane regardless of which panel is focused in Claude Code Desktop. The pane is visually rendering content on screen — only the MCP screenshot capture fails.Error Messages/Logs
Steps to Reproduce
preview_startpreview_screenshotautonomouslyAlternatively, verify the root cause directly:
preview_startpreview_evalwith expressiondocument.visibilityStatewhile reading chat"hidden"— confirms compositor is not painting the preview paneClaude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
Claude Code Desktop: Claude/1.4758.0
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Environment:
Why users cannot fix this themselves:
The preview pane is a BrowserWindow or WebContentsView created internally by Claude Code Desktop. Users have no access to the Electron layer, no ability to pass window creation options, and no way to inject Chrome flags into that specific window. Every JS-level workaround was tested and failed — the compositor simply does not paint hidden windows regardless of what the page JavaScript does.
Suggested fix (one of the following, applied in Claude Code Desktop's Electron code):
paintWhenInitiallyHidden: trueon the preview BrowserWindow/WebContentsView--disable-renderer-backgroundingChrome flag to the preview window--disable-backgrounding-occluded-windowsChrome flag--disable-features=CalculateNativeWinOcclusionChrome flagNote: When the preview pane IS the foreground window,
visibilityStateis"visible"andpreview_screenshotworks correctly. This confirms the pane renders fine — only the backgrounding behaviour needs to be disabled.Impact:
preview_screenshotcall during autonomous agent work times out (30 seconds each)