Draft-js: Editor lost focus after first word (space bar is pressed) on Android browser.

Created on 20 Dec 2016  路  7Comments  路  Source: facebook/draft-js

Having problem with Draft.js editor on Android (Android 6.0 chrome / browser / ) .
whenever I pressed the first space bar, the Editor lost focus. the next space bar is ok.
Draft.js 0.9.1

android bug

Most helpful comment

Hmm... I searched space bar on the issues tracker and found myself here, evidently I didn't try googling "draft-js android"... anyway...

From the searches that turn up, it seems like issues on mobile are being continually glossed over with the excuse that mobile devices are not supported for the time being. Either we call this a bug or Draft officially doesn't support mobile devices. Which is it? If mobile is not supported, this needs to be prominently mentioned in the docs, preferably right on the front page (as of now, I see no mention of it at all, not even in the known issues section).

All 7 comments

I too am seeing all kinds of issues when hitting spacebar on Android.

First of all, the OP's exact issue, the keyboard disappearing, for me is only happening when I use react-rte. However, the same sequence is causing other issues in both draft-js and react-rte so I'm guessing the underlying problem is with draft. Problems can be seen on the demos here:
https://facebook.github.io/draft-js/
https://react-rte.org/demo

Using the Draft demo:
1) Type a few characters into the textarea, followed by a space, then keep typing... no issue
2) Use the delete key to delete all of the text
3) Type in a few more characters, then hit space... Suddenly, inserted after your space is the first character you typed in step one. For example, if you typed "AAA ", then deleted, then typed "BBB " you would now see "BBB A"
4) Keep typing and you will not have any more issue with the next spaces.

With the react-rte demo, the on-screen keyboard disappears whenever this happens. On your first sequence, the keyboard disappears on the first space as well, so the issue is there, but that "first character" doesn't exist yet I supposes.

if you did some search in the 'issues', you will find that android is not supported now. 馃槩

So I guess FB doesn't use Draft.js for their mobile version. Is that true? 'Cause I have no problem using FB web mobile on my Android phone.

Hmm... I searched space bar on the issues tracker and found myself here, evidently I didn't try googling "draft-js android"... anyway...

From the searches that turn up, it seems like issues on mobile are being continually glossed over with the excuse that mobile devices are not supported for the time being. Either we call this a bug or Draft officially doesn't support mobile devices. Which is it? If mobile is not supported, this needs to be prominently mentioned in the docs, preferably right on the front page (as of now, I see no mention of it at all, not even in the known issues section).

I agree that lack of mobile support should be mentioned in the 'Issues and Pitfalls' article (http://facebook.github.io/draft-js/docs/advanced-topics-issues-and-pitfalls.html).

Note that some work has been done to improve Android support, notably https://github.com/facebook/draft-js/pull/175 and https://github.com/facebook/draft-js/pull/572, but these pull requests have unfortunately not yet been merged.

I was able to sidestep this issue by by disabling autocorrect on the contentdeditable element.
https://davidwalsh.name/disable-autocorrect

Was this page helpful?
0 / 5 - 0 ratings