Repository navigation
Cmd+C copy shortcut freezes #343489
Copy link
Copy link
Closed
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersregressionSomething that used to work is now brokenSomething that used to work is now brokenverifiedVerification succeededVerification succeededwebviewWebview issuesWebview issues
Milestone
Description
Type: Bug
- VS Code Version: 1.143.0 (commit 2d0b750)
- OS Version: macOS 26.6.2 (arm64 / Apple Silicon)
- Extension: Anthropic Claude Code (v2.1.205), but likely affects any webview
Describe the bug:
After auto-updating from 1.142.0 to 1.143.0 (Oct 21, 2026), copying selected text
inside a webview (Claude Code chat panel) stopped working:
- Select text in the rendered chat response, press Cmd+C → the input box gets
focus instead of copying (nothing is copied). - Right-click → Copy → also no effect.
- Note: text I type myself (user messages) still copies fine; only the extension's
rendered markdown response text is affected.
Key clue / workaround:
If I first click the code block's "copy" button, then Cmd+C on subsequently selected
text starts working again. This suggests the webview's clipboard access is not
initialized/activated until an explicit clipboard write happens.
To Reproduce:
- Install the Claude Code extension, open it in a panel (webview).
- Send a message and let Claude reply (rendered markdown).
- Select some of the response text.
- Press Cmd+C → focus jumps to the input box, nothing copied.
- Right-click → Copy → also no effect.
Expected behavior:
Cmd+C (and right-click Copy) should copy the selected text to the clipboard,
as it did in 1.142.0.
Additional context:
- Regression: worked fine in 1.142.0, broke after auto-update to 1.143.0.
- The extension did not update (extension auto-update is off), so this points to
a webview clipboard regression in VS Code itself, not the extension.
VS Code version: Code 1.143.0 (Universal) (2d0b750, 2026-10-20T14:31:47-07:00)
OS version: Darwin arm64 25.6.0
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Apple M3 (8 x 2400) |
| GPU Status | 2d_canvas: enabled GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M3, Version 26.6.2 (Build 25G83))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.6.2 ACTIVE Machine model name: Mac Machine model version: 15.12 direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: enabled_on trees_in_viz: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | 2, 2, 3 |
| Memory (System) | 24.00GB (0.18GB free) |
| Process Argv | --crash-reporter-id 75cea50a-da50-4bb0-8bdd-369427a02852 |
| Screen Reader | no |
| VM | 0% |
Extensions (9)
| Name | Identifier | Author | Version |
|---|---|---|---|
| Claude Code for VS Code | anthropic.claude-code | Anthropic | 2.1.205 |
| Spell Right | ban.spellright | ban | 3.0.154 |
| ccgit | codon19.ccgit | codon19 | 0.1.0 |
| LaTeX Workshop | james-yu.latex-workshop | James-Yu | 10.16.1 |
| LaTeX | mathematic.vscode-latex | mathematic | 2.0.0 |
| Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code | ms-ceintl.vscode-language-pack-zh-hans | MS-CEINTL | 1.128.2026070703 |
| 中文翻译英文插件 | quanyj.zh-translate-en | quanyj | 0.2.2 |
| Markdown 增强预览 | shd101wyy.markdown-preview-enhanced | shd101wyy | 0.8.35 |
| vscode-pdf | tomoki1207.pdf | tomoki1207 | 1.2.2 |
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
cloudbuttont:31379625
3efgi100_wstrepl:31403338
55ia6109:31457054
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31572277
8hhj4413:31478653
cp_cls_c_1081:31454833
conptydll_true:31498968
e9c30283:31461165
46204921:31447328
control_6dc23131:31590236
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
2d1bi976:31596492
i2gc6536:31499202
52612955:31516516
23c7c724:31520045
ddid_c:31478207
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
608b4df9:31595861
logging_enabled_new:31498466
db5d2638:31499441
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
a1ije391_t:31540920
jbcp_cls_pctr_t:31531130
cp_intellij_t_nes:31548657
ahp-both-windows:31556933
hjji5903:31534458
9gg7f176:31542112
sandbox-ui-on-2:31543161
nes-ex-cf-euporie-03:31542868
enable_editor_pane_layout:31569726
allow-none:31555437
ac562147:31564510
1h923230:31564177
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0d8dfbc3:31570291
nemo-v2:31565334
0c1h4866:31566224
session-mark-done:31591648
plus-and-new:31602494
multi-root:31593626
5b8j3302:31564601
autotiers:31584978
mangle-name-control:31572633
atk_rai_validation_enable:31598258
allow-signed-out:31592042
b17abb00-cfec-4134-90da-ee5e32ce4426:31602001
intellij_nes_preview_t:31580086
39a5d156:31574986
links-treatment:31596176
aw-autom-on:31583758
issue9151-8b8b39eb:31597539
usage_tips_endabled_0911:31587631
7g328426_fixed:31595622
codex-agent-host-stable-editor:31599810
9b7i0944:31600022
skill-budget-30000:31597277
sessioninlinediffenabled_enabled:31587635
welcomesignin9359t:31602106
e6882f69-f5cc-4f90-9073-69a4ca3e50ea:31602109
d6a5dc66-a24d-4215-bf31-317b28ac768a:31603712
ee75ae2a-d344-4855-a1a7-ebec120dec2d:31601709
5a177259:31599157
i67i8290:31599156
edbgf432:31599155
msft-auth-on:31593345
variation2-current-feedback:31600291
permission_prompt_control:1332567
ccr_pr_nudge_auto_review:1467214
vsc_wsm_c:1340633
cfee5631:1379228
4cj51803:1433348
hdfaf120:1463096
cmc_aa_t:1435711
t_ws_f7ce1948:1455090
2ca6g807:1460390
seatcta-d9cadb09:1462477
stb_c_6d50a622:1455226
l_0ea5f882:1466824
Reacted by Mark Novikov
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersregressionSomething that used to work is now brokenSomething that used to work is now brokenverifiedVerification succeededVerification succeededwebviewWebview issuesWebview issues
Activity
gaord commentedon Oct 22, 2026
Confirming this on 1.143.0 with a different webview extension, and it looks like a
regression in the webview shell rather than in any one extension. Same version and
commit as the report (
2d0b7506a36c).Cause
src/vs/workbench/contrib/webview/browser/pre/index.html, theexecCommandhandler.f5f64f08ab("Restore webview input focus before native clipboard commands",2026-10-14) added a
lastFocusedElementsWeakMap (fed byfocusinon the frame)and, before replaying a host copy:
In 1.142.0 the handler was just
assertIsDefined(target.contentDocument).execCommand(data);.A drag-selection made in a container that cannot take focus (a plain
<div>ofrendered markdown) leaves
activeElementonbody, so this branch runs. If thelast element to take focus in that frame was the composer
<textarea>, focusingit moves the document selection into the editable field and the range selection
is destroyed — the copy then runs on an empty selection, which is why the
clipboard ends up empty rather than stale.
Two measurements that pin it down:
<textarea>clears a 73-character range selection (73 → 0), whilefocusing a
<button>leaves it intact (73 → 73). So it is the restore-to-an-editable-element that eats the selection, not the focus change itself.
ends with 0 selected and 0 copied. With the container the selection lives in
made focusable (
tabindex="-1", focused on mousedown) the same sequence copiesall 216.
Why the workaround in the report works
Clicking the code block's copy button makes the last focused element a button
inside the frame, and restoring focus to a button does not touch the selection —
so the next ⌘C works. It also is not "rendered markdown vs. text the user typed":
what decides it is whether the container the selection lives in can hold focus.
Content inside a focusable wrapper, or in a block that was just clicked, copies
fine; a plain paragraph does not.
Suggested fix
Skip the restore when it could cost a selection, and/or when the command does not
need a focused target:
Extensions can work around it by making their transcript focusable — that is what
I did in mine — but that is a workaround every webview extension has to rediscover
on 1.143. Happy to test a build if a candidate fix needs an outside webview.
(FYI #343488 looks like the same report.)
Fix copying chat messages in VS Code 1.143
Bump eca-webview: fix copying chat messages in VS Code 1.143
baselbj commentedon Oct 22, 2026
Same issue on Linux + Wayland.
After updating to 1.143.0, copying selected text inside the webview stopped working:
Ctrl+C temporarily, then it stops again
Confirming this also affects Linux, not only macOS.
webview: preserve text selection before clipboard commands (#344428)
fix: VS Code 1.143 下选中日志 Ctrl+C 复制不出来(焦点收拢到日志容器)