Prosemirror version mismatch can cause unexpected behaviour

My last two self-answered questions seemed to help some people. So, I am going to just document this too.

We use Prosemirror in two different projects, which are set up very similarly (same plugins). The newer project had many weird bugs like randomly losing focus on mobile devices, the toggle mark not working, the selection going to the end sometimes, etc. But, there were no error messages in the browser console.

The first thing I tried was disabling all plugins to make sure that plugins do not cause this. And, they did not. After trying for multiple hours, I figured out it was because of a version mismatch between prosemirror- packages.

So, if you are having an issue that seems impossible to fix, try updating all core prosemirror packages to the latest version. I also had to add prosemirror-transform to dependencies. Then, make sure to restart dev servers (ex: Vite).

  • prosemirror-model
  • prosemirror-state
  • prosemirror-view
  • prosemirror-transform
  • etc…