Prosemirror: Issues with contenteditable=false on Android

Created on 21 Feb 2017  Â·  10Comments  Â·  Source: ProseMirror/prosemirror

Working on integrating editor based on prosemirror in our mobile products we've faced some critical for us issues with contenteditable=false on Android.

I've tested on:

  • Android: 7.1
  • Chrome: 56
  • Nexus 5X and Emulator in Android Studio

Issues:

  • Selection dismisses and keyboard closes when cursor meets contenteditable=false node – which is not good for UX of an editor.
  • It's impossible to delete (e.g. Backspace) contenteditable=false node.

kapture 2017-02-21 at 10 38 14

Example on CodePen:

http://codepen.io/iamsysoev/pen/ggVOeg

Our use cases:

  • mention nodes e.g. @username
  • media cards nodes e.g. carousel with images

Changes in prosemirror since 0.10:

Since recently prosemirror automatically adds contenteditable=false https://github.com/ProseMirror/prosemirror-view/blob/master/src/viewdesc.js#L429 which breaks android in aforementioned cases.

In prosemirror 0.10 it was possible to create leaf/inline node without contenteditable=false, but any text you type after such node becomes a part of this node on Android:

kapture 2017-02-21 at 11 24 51

Related Chromium bugs:

Some thoughts:

I don't think it's possible to fix both these issues (since browser bug). But maybe you can come up with some workarounds for these issues. Because it's crucial for editor to have none editable nodes in somehow interact with them.

Most helpful comment

I solved this by using a zero-width space after the token and detecting when its deleted. I figured it out by using chrome://inspect with Quip ;)

All 10 comments

Any update on this bug?

AFAIK issue in Chromium is still open...

I solved this by using a zero-width space after the token and detecting when its deleted. I figured it out by using chrome://inspect with Quip ;)

I'm not using prosemirror btw. I build a custom editor but noticed that most editors have this problem. :/

Any update?

I experience this bug only while using the Gboard (software keyboard), I don't have this bug while using the Samsung keyboard (hardware keyboard).

@ccorcos Could you please show how you solved this issue?

I'm not using prosemirror. I wrote my own editor and am doing some magic with a zero-width space.

I solved this by using a zero-width space after the token and detecting when its deleted. I figured it out by using chrome://inspect with Quip ;)

can u share some code examples? It will help us to resolve same.

I could fix the issue with help of https://github.com/ProseMirror/prosemirror/issues/903 with:

  inline: true, 
  group: 'inline',
  selectable: true,
  draggable: true,

Note that in my tests draggable and selectable had to be set to true.

 toDOM(node) {
   const attrs = {
         contentEditable: 'false',
         style: 'display:inline-block'
      };
     return ['span', attrs, ['span', { style: 'display:block'}, '@'+node.attrs.name] ];
},

Tested with SwiftKey and Gboard, did not test with WebViews.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lastnigtic picture lastnigtic  Â·  6Comments

vandenoever picture vandenoever  Â·  9Comments

kepta picture kepta  Â·  4Comments

aeneasr picture aeneasr  Â·  6Comments

stevemao picture stevemao  Â·  5Comments