Hello,
I have CodeMirror 6 setup inside an angular 15 application. For the most part, everything seems to work fine, except for one thing: Whenever the user clicks inside the editor, an error appears in the devtools. Here is the error message on chrome/edge:
Unable to preventDefault inside passive event listener invocation.
And this is the error message on firefox:
Ignoring ‘preventDefault()’ call on event of type ‘mouseup’ from a listener registered as ‘passive’.
From what I gathered, the error seems to come from a class called MouseSelection
(see image).
Now I’m wondering: Am I doing something wrong, or is this an issue with CodeMirror?
The way I’m instancing the editor is as follows:
Inside the constructor, I create the editorView object:
this.editorView = new EditorView();
After the view is initialized, I setup the EditorState and add it to the DOM, as such:
const editorExtensions = [
basicSetup,
images(),
math(),
this.initLanguage(this.language),
];
const editorState = EditorState..create({
doc: yText.toString(),
extensions: editorExtensions,
});
this.editorView.setState(this.setupEditorState());
this.editorParentElement.appendChild(this.editorView.dom);
The editorParentElement
variable is a HTMLElement object which contains the editor’s parent (a div element)