Holding down delete results in unexpected behavior

I have a schema which contains a document, paragraphs, and image nodes. I use the baseKeymap bindings.

Text is also included though I don’t need it (a separate question but why must I allow text?).

In mobile safari, holding the backspace key will result in multiple deletes, unless a very specific scenario: the cursor is inside a paragraph (always true) and to the right of 2 or more image nodes. Then holding the key performs a single delete, when I would prefer it to continue deleting.

I don’t have a mobile safari device handy right now, but it is possible that it has a bug where calling preventDefault on keydown will prevent the key from repeating when held. Could you test that? Open a page that does something like window.onkeydown = e => { document.body.appendChild(document.createElement("X")); e.preventDefault() } and see if the Xs accumulate when you hold backspace.

If that’s it, this’d be a hard to work around—we do need to handle that initial backspace press, to make sure the node is deleted as it should be. Though maybe the native behavior in iOS does the right thing in this case—we could experiment with that.

I think this is an issue on my end. On mobile safari, repeated deletes occur in the the basic prosemirror example, and in my case repeated deletes occur when the content is a bunch of empty paragraphs. Something about my node types causes an issue, my plan is to step through the backspace command in the basicKeymap.

I tried binding to keydown in handleDOMEvents without calling preventDefault, and also replacing the preventDefault method (on the backspace key) in case something else was calling it. No luck.

I reproduced the issue in the basic editor inserting img nodes. They will prevent repeated delete on mobile Safari.