shshaw
February 10, 2026, 8:19pm
1
When rendering CodeMirror in a ShadowDOM root, Cmd + A (or Edit > Select All) and then Copy doesn’t actually select all the contents of the CodeMirror doc. It seems like the way CodeMirror only renders part of the doc to the actual DOM is interfering with Safari’s ability to copy.
CodeMirror Try Example
Select All + Copy works in Chrome & Firefox, but not Safari. Depending on the viewport, you may only get ~30 lines copied.
This only seems to happen with the ShadowDOM. A CodeMirror instance attached to the document.body doesn’t seem to have the same problem.
marijn
February 11, 2026, 8:08am
2
Thanks for the report. Looks like this broke in 6.39.11. This patch should help.
committed 08:07AM - 11 Feb 26 UTC
FIX: Fix a regression where copy and cut in a shadow DOM on Safari would fall ba… ck to
the native behavior, often copying the wrong text.
See https://discuss.codemirror.net/t/unable-to-select-all-copy-with-safari-shadowdom-rendering/9675
shshaw
February 11, 2026, 3:12pm
3
Ah! Thank you for fixing.
Mind doing a version bump of @codemirror /view so I can update the package & test?