The purpose of this issue is to consolidate and fix all Android bugs, especially those that are showstoppers (i.e. bugs that if we don't fix we can't claim to have Android support).
If you want Android support, you can help make it happen by testing and providing good bug reports. Note: If you can't recreate the bug, please do not submit it (e.g. needs to e more specific than "sometimes backspace doesn't work").
Thank you to the many that have asked what they can do to help with Android. This is the best way to do it. Once I'm off on the next project, it may be a while before I get back here.
Currently supporting Android 8 and Android 9. Working on supporting Android 7 right now. Will post here when you can start testing Android 7.
Use my Slate examples site (not the official Slate examples). The official repo does not have my latest Android updates:
https://thesunny.github.io/slate/#/composition/split-join
Cut and paste these steps into your bug report
Make sure you are using https://thesunny.github.io/slate/ then
Describe the issue including:
- Steps to reproduce
- What you were trying to do
- What happened
- Report anything unusual in the Slate value at bottom of composition example
A GIF showing the issue in action.
http://recordit.co/
Please answer the following
Note: Android API is in the top right corner of the link posted above
[ ] What Android API version are you on?
[ ] What Android device are you using?
[ ] Are you using a `simulator` or `hardware`?
[ ] Which example page were you using?
(If someone has a better way to do anything mentioned, I will update this comment)
Check the version of Android on your phone, then visit this link: https://source.android.com/setup/start/build-numbers
This thread could get a little dicey as issues stack up. For now I'll report here, but I'll move it to a separate issue and link here if you think that will be more manageable. Just let me know.
Major
Can be worked around by not using placeholders, but crashes catastrophically when you do use them
Hold backspace from the end of the document until you reach the beginning, clearing all contents. Upon completion, some portion of, or all of, the contents will return. Trying to reposition the cursor when this occurs becomes impossible and it seems to be stuck in a loop setting the selection.
| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Placeholder |
MAJOR
This can be avoided by not erasing the entire contents, but if you do, the editor gets stuck in an unescapable loop
Starting at the end of the content of the editor, erase the entire contents by holding down backspace and continue to hold when you reach the beginning of the document. When you reach the beginning, some of the contents will reappear. Now try changing the selection. Your selection will be constantly reset no matter where you click.
You can set an expanded selection by long-pressing a word, and this will work, but as soon as the selection is unexpanded the loop resumes.
| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Composition |
Major
There's no easy workaround for users and in more complex examples, this can cause editor crashes.
Long press to select and choose, 'Select All', then press backspace. On the first press your selection will collapse, but it will probably not delete anything. Repeat the process and the editor should delete the last character. Repeat it again and the editor will delete the last character again.
You can also do this with individual words. The behavior here may elucidate the cause for you @thesunny. The word is briefly removed when you select it and hit backspace, but it then returns after a split second with only its last character removed.
| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Plaintext |
This should be working in API28. Once confirmed that it works, the same fix should work on Android 8 (API 26, 27).
Should work for two different situations
Note: Won't work if selection is larger than one block currently. This will be fixed later.
Major
I chose major because I can find no workaround that an average user could use.
Cutting and pasting with no document change inbetween Cut and Paste
Cutting and pasting to a new line - I also managed to get this outcome by adding a space at the end of the line instead of a new line, but only once. The line break MUST be created between Cut and Paste. If it is created beforehand, the behavior is the same as the first recording.
Tap the editor to get an initial selection (you will see why this is important,) then long press a word. Tap 'Select All' and then tap 'Cut.' The selection will collapse to the initially selected word and only it will be cut.
If copying, the selection will collapse to the end of the document, and only the initially selected word will be copied.
Special circumstance: You can successfully cut (and paste) the expanded selection if there has been no prior selection in the editor and your initial interaction is a long press (Recording), although you'll see there's some selection weirdness where the context menu does not occur until you tap the expanded selection again.
| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Plaintext |
Major
This is considered major because typing any text will not update the editor state - this means that any edit on the text will not do anything. Although the UI appears to be working as intended, the editor state is not properly updated so you cannot persist/save the new state.
Open the editor, tap on the editor to begin typing, then type any character. This will throw the following exception:
Uncaught TypeError: Cannot read property 'values' of undefined
This exception is thrown during the reconcile function in the Android plugin. This function calls setTextFromDomNode -> node.getLeaves -> compile. The compile function throws an error because annotation and decorations values are undefined.
You'll see in the video that the Slate's value as text doesn't get updated
| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 3 XL |
| Physical hardware, or emulated device? | Hardware (with remote debugging setup on my MacBook to show console errors) |
| Which example page? | Composition |
| Slate version | v0.47.2 |
| Slate react version | v0.22.2|
I had to pull the latest project becase the currently deployed examples on https://thesunny.github.io/slate/#/composition/split-join does not have the latest version of slate and slate-react.
Thanks for all the submissions guys. I'm working on a new approach so please hold off on bug reports for now. For more information, please see this comment in the IME issue https://github.com/ianstormtaylor/slate/issues/2062#issuecomment-492320466
No problem @thesunny. Thanks again for all your hard work and for keeping us in the loop!!
Please see this new issue for submitting bugs:
So for clarity for those following, I rewrote the engine to use MutationObserver in the hope that it will solve problems more consistently. I wrote the Android 9 version and with only one fix got Android 8 working so it seems to have met the goal. The previous version had separate code for Android 8 and Android 9 and the current version shares code.
Because the engine was rewritten, the old bugs don't really apply. I did test range deletes which I got working (mentioned above). I don't know about cut/paste but will test that.
All the other backspace issues basically work if you click backspace one at a time. Holding down backspace can sometimes give odd behavior but will not crash the editor.
Most helpful comment
Thanks for all the submissions guys. I'm working on a new approach so please hold off on bug reports for now. For more information, please see this comment in the IME issue https://github.com/ianstormtaylor/slate/issues/2062#issuecomment-492320466