Wrong cursor placement with custom plugin and custom `Enter` behaviour (Firefox only)

Hello there,

I’ve recently started using Tiptap (which is built on top of ProseMirror), and I’ve built a custom ProseMirror plugin to implement some custom behaviour when pressing the Enter key in certain situations.

The idea is to implement something like GitHub, where the Markdown list marker (i.e., * ) is added automatically when pressing the Enter key. It also deletes the list marker if the user presses the Enter key when there is no text before (just the marker), and this is where I found a problem with Firefox (but no Chrome/Edge, I’m on Windows).

Here’s a demo of the issue on Firefox:


You can see that the cursor goes to the previous line (when deleting the list marker), but it shouldn’t. And that’s not what happens on Chromium based browsers, such as Edge:


I have created a CodeSandbox with my code here:

Could this be another Firefox bug? Or maybe something I can fix on my side?

@marijn Any pointers with this one? :pray:

Since this sounds like a problem with your own code, rather than a library issue, I don’t plan to debug it for you.

Can you please clarify why do you think this is a problem in my own code? I don’t have this problem in Edge or Chrome, only Firefox, how can my code be the culprit? :thinking:

Right, sure, it might be a library issue, or more likely a browser bug. But since you include a rather complicated scenario description that involves a bunch of custom setup, figuring out what is actually happening would involve quite a lot of effort from me, probably to only end up with the conclusion that yes, it’s a browser bug. I have a lot of my plate and thus don’t have time to dig into every problem posted here.

I have a lot of my plate and thus don’t have time to dig into every problem posted here.

I can relate to that, but I never meant to post this in a way for you to dig deep into this issue. I’m sure you have a lot to deal with, and this is not a high-priority task.

By browsing these forums, I’ve noticed that there are quite a few Firefox bugs (and I think I might’ve seen some of those posted by you on Bugzilla), and all I was trying to understand was if this felt like a glaring Firefox problem or not.

For the sake of a conclusion: I’ve tried multiple workarounds on my side to do the same thing as “deleting text” (the original and the one in the CodeSandbox), “selecting and then deleting the selection”, “moving the cursor first, and then deleting text from a different position”, etc, but not solved it. I’ve also tested this on Safari, Chrome, Edge, and Opera, and they all worked as expected. The only know where this doesn’t work is Firefox. So there’s a 99% chance this is indeed a Firefox bug.

@marijn Thank you for your time, have a nice weekend.