Avoid selection background highlight within selected node


I have implemented a custom math node in my ProseMirror project (using katex). Up until this point, whenever such a node was selected, the content within the node was not highlighted in blue (as usual text selections are). But since I’ve upgraded from 0.18 to 0.21 this started happening.

Any idea how I can I avoid the blue highlighting? I.e. how can I get what’s on the left instead of what’s on the right, when I select a node?


When a node is selected (and ProseMirror is focused) the DOM selection will be set across the node. You’ll have to use a CSS hack to hide selection highlighting inside of the node when the editor is focused. See for example the way the footnote demo, which has a similar problem, does it.

1 Like