Clickable controls in node-views - avoiding cursor movement

I’m having a hard time implementing clickable buttons in a node-view in such a way that the click doesn’t also move the cursor.

I’ve added event.stopPropagation(), event.preventDefault() and return false to all of: onmouseup, onmousedown, onpointerup, onpointerdown, onclick, but the caret still moves sometimes.

I realise I can use the handleClickOn⁠ editor prop, but I’d rather avoid a global coupling like that if I can. I’m a bit mystified how the event is still getting through.

BTW my node-views are implemented using SolidJS (which is a brilliant fit with ProseMirror) so it’s possible I am missing some SolidJS subtlety about event handling, but I don’t think so.

Thanks

Tom

Are you using stopEvent method on your node view? That might be necessary to make ProseMirror ignore the event entirely. If that doesn’t help, maybe add a breakpoint to EditorView.updateState to figure out why it is getting called in this situation.

This turned out to be just a dumb slip-up in my own code. Sorry for the noise!

Thanks for the tips - they helped me to debug and useful for future reference.