-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Facebook#1077 - Fix for input bug on Android - space or a special char clears the input #1500
Conversation
…char clears the input)
…char clears the input)
This works perfectly in our project and fixes typing on my german Android keyboard. |
Somebody submitted 5 line patch upstream to DraftJS which (should) fix DraftJS on Android. (facebookarchive/draft-js#1500) I tested this locally and it works super well on my phone, so I pulled the repo locally and deployed a quick fork. This PR just sets the package `draft-js` to install the fork based on that PR instead. Note that this isn't any kind of long-term solution, but it finally fixes the problem and let's me respond to messages from my phone, so I say fuck long-term and let's ship this.
Just to report back, we've been running this patch in production for a week now and have gotten 0 complaints about typing on Android anymore. 🎉 |
Update: This doesn't work perfectly, while it makes it possible to type on a german keyboard there's still bugs when autocorrecting/in some other cases that I haven't been able to track down. At least it doesn't crash the editor though... |
I found this works better with my keyboard
due sometimes the value of |
Seeing this issue recently on draft-js using Gboard only. |
Also confirmed that this is popping up on draft-js using Gboard. |
Just tested this on Android and it 100% does not work. Unlike other editors, you can't even trick Draft into marginally working. |
This seems to be broken when the caret is placed in the middle of another word. Typing any character causes the full gboard suggestion to be inserted. |
@aminland I can't get anywhere close to that level of functionality with Gboard. |
Sorry I meant that's the behaviour with this PR applied. |
@flarnie any way we could get this test and merged for any future release? |
@sophiebits just to note, as I said above the typing experience still sucks on Android with this patch applied. Autocorrect messes the text up really really bad. The only thing this patch adds is that the editor doesn't crash on Android, but imo this isn't anywhere ready for production usage with real users. |
We got draft js working on android, but ended up serving a custom textarea component and plugging into/building the editorstate object ourselves on submit. |
@pb-expa that's exactly what we did too! 👍 See withspectrum/spectrum#2868, specifically our custom |
Please stop posting +1. I'm going to delete all the (many) +1 comments here. The way this gets merged is if we find answers to the questions I posted above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes until the questions that @sophiebits asked above are answered.
Lots of information related to those questions here: ianstormtaylor/slate#2062 As per @thesunny's research, as I understand it, there is no |
@sophiebits You should just merge it, even a partial fix is a better fix than leaving it bugging. We heavily invested in integrating this component and turns out it's unusable on Android devices. It's bad that it's not working, but it's a real shame FB that you're even halting the patches to be merged. |
I wrote the Android compatibility for SlateJS. Thought I'd pop in and give some hints. To get Android to work, here are a few key things that you will need for Android:
Good luck guys. It took several solid weeks of work for me but if you look at the code, you can probably save time. |
Here's the issue which contains the most info: Here's the new PR: Here an older PR with more details: |
Ok, my friends, I am closing this PR. First, it was never a fix for the full problem, I covered only limited number of issues, listed in the description - at that point in time it was enough. Since I issued this fix, Google implemented a lot of changes that make this fix just utterly insufficient: so many other issues appeared and fixing just this side effect doesn't change the game significantly at all. |
Summary
Fix for input bug on Android - typing space or a special char clears the input
#1077
Test Plan
Expected behavior:
Text is not cleared, autocomplete is applied as expected
Wrong behavior fixed by this change:
Text is cleared or wrong symbols are added