(Safari 16.4) Unable to mount CodeMirror on an element in the ShadowDOM

Hello,

I’ve recently updated to Safari 16.4 and stumbled upon an issue (not present in previous versions) where the editor is not mounting properly when trying to attach it to an element in the Shadow DOM.

It seems like this line in the StyleSet class is what’s failing.

root.adoptedStyleSheets = [this.sheet].concat(root.adoptedStyleSheets)
[Error] Unhandled Promise Rejection: TypeError: Type error
	StyleSet (style-mod.js:93)
	mount (style-mod.js:79)
        ...

Thank you!

Is your version of style-mod at 4.0.2?

Hey @marijn,

We were still on 4.0.0. Rebuilding the yarn.lock file solved the issue for us.

Thanks a bunch!

@marijn

I am also facing the exact same issue in safari 16.4 and 16.5. How do I update the style-mod version? I am using the following codemirror packages which have been updated to the latest.

@codemirror/autocomplete”: “^6.7.1”,
@codemirror/commands”: “^6.2.4”,
@codemirror/language”: “^6.7.0”,
@codemirror/state”: “^6.2.0”,
@codemirror/view”: “^6.12.0”,
@lezer/highlight”: “^1.1.4”,

Thanks.

Nevermind. Based on @perkrlsn 's comment I deleted node_modules and package-lock.json and did a clean build and it is working now.