ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.53k stars 334 forks source link

Very buggy/glitchy lifting of nested list item using Backspace on Android #1448

Open thecodrr opened 4 months ago

thecodrr commented 4 months ago

Here's a video demo:

https://github.com/ProseMirror/prosemirror/assets/7473959/bcce1766-c270-4d98-b417-53100c3cd02e

This issue is reproducible on Firefox using OpenBoard, SwiftKey & GBoard.

On Google Chrome, the issue is completely different:

https://github.com/ProseMirror/prosemirror/assets/7473959/a95bcd35-77ef-4da2-8b74-21452d0025e4

Tested on the default editor on https://prosemirror.net

marijnh commented 4 months ago

Firefox Android's default backspace behavior in list items seems extremely buggy. And because it doesn't, for some reason, fire an actual keydown event that's identifiable as backspace when you hit the virtual keyboard's backspace, ProseMirror isn't able to reconstruct that backspacing is happening, so it can't do much except integrate the weird DOM changes it sees the browser make into its document.

It is easy to reproduce many of these without ProseMirror. For example, in this document, if you put the cursor in the empty paragraph and press backspace, you for some reason get a new empty list item before the "Two" item, even though the cursor was after it.

<div contenteditable="true"><ul><li><p>One</p><ul><li><p>Two</p></li></ul><p><br></p></li></ul></div>

Given that this is clearly a browser issue, and that Firefox's market share on Android is tiny, I'm not super motivated to try and add kludges to detect and work around this.

Attached patch solves at least one list-related issue on Chrome. But I wasn't able to see the behavior you show in your video. Some of the backspace behavior shown there is exactly what I would expect. Instead of a video, a precise textual description of what document you start with and which steps you need to take to get the behavior you didn't expect would be easier to work with.