Unable to Select All & Copy with Safari + ShadowDOM Rendering.

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.

Thanks for the report. Looks like this broke in 6.39.11. This patch should help.

Ah! Thank you for fixing.

Mind doing a version bump of @codemirror/view so I can update the package & test?

I’ve tagged 6.39.14

1 Like