We’ve discovered some strange behavior that I wanted to discuss before filing a bug. A 3rd party library in our application is listening to blur/focus events and on focus, they are setting their own data-attribute on our root ProseMirror div. (I believe they are binding to
document.activeElement, which at the time that their code runs is the editor).
The result is that, if a NodeView is selected when you switch tabs away and return, the editor selection is recomputed and actually moves to the previous block (out of the NodeView).
Here’s a GIF showing the behavior and a link to a Codesandbox.
While I understand that it would be preferable that the 3rd party doesnt alter DOM elements that it isn’t supposed to, we also reproduced this with a Chrome extension.
Is it a bug that the selection is changing? Is there any way we can ignore this mutation that happens directly on the ProseMirror root itself?
CodeSandbox: ProseMirror Node View Example - CodeSandbox