Slate: Fix all showstopper bugs in Slate on Android (Help us by reporting and testing bugs)

Created on 1 May 2019  Â·  10Comments  Â·  Source: ianstormtaylor/slate

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.

Supported Android Versions 8 and 9 (API 26, 27, 28)

Currently supporting Android 8 and Android 9. Working on supporting Android 7 right now. Will post here when you can start testing Android 7.

Where to test Android support

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

What to submit in a bug report

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?
android bug ♥ help ⚑ cross platform ⚑ ime ⚑ mobile

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

All 10 comments

(If someone has a better way to do anything mentioned, I will update this comment)

Easiest way to create screen recordings

  1. Download DU Recorder from the Play Store (Play store seems to be having issues currently)
  2. Create your screen recording.
  3. Upload your created file at https://imgur.com/upload to get a shareable link - I use Join to send the file to my PC and upload it to Imgur from there.
  4. Share your recording and ensure that you explain the steps to recreate the bug AND that the recording is not too fast for someone to decipher what's going on. It's likely it will take a few tries to get a solid recording for some bugs and you might be feeling impatient. Take the extra 10 seconds to ensure a quality recording for your bug report.

Finding the API version for your version of Android:

Check the version of Android on your phone, then visit this link: https://source.android.com/setup/start/build-numbers


Suggested issue template:

This is the template I've used for my reported issues

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.

Bug: Placeholder overlap and deletion crash

Severity

Major

Rationale for severity

Can be worked around by not using placeholders, but crashes catastrophically when you do use them

Recording

https://imgur.com/a/K7pGCfb

Description

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 and Slate Info

| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Placeholder |

Bug: Emptying document contents by holding backspace leads to infinite loop

Severity

MAJOR

Rationale for severity

This can be avoided by not erasing the entire contents, but if you do, the editor gets stuck in an unescapable loop

Recording

https://imgur.com/a/TL7tgvK

Description

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.

When tapping backspace repeatedly to delete the entire contents, rather than holding it continuously, the editor crashes instead of becoming stuck in a loop.

Android and Slate Info

| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Composition |

Bug: Deletion of expanded selection only removes final character

Severity

Major

Rationale for severity

There's no easy workaround for users and in more complex examples, this can cause editor crashes.

Recording

https://imgur.com/a/dhWBLZW

Description

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 and Slate Info

| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Plaintext |

Status

  • [x] Ready for testing from thesunny
  • [ ] Tested and confirmed working by @

Status Notes

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

  • Select word and hit backspace once
  • Select word and hold backspace for a while (but not over a line break yet)

Note: Won't work if selection is larger than one block currently. This will be fixed later.

Bug: Cutting or copying expanded contents cuts/copies only the initially selected word

Severity

Major

Rationale for severity

I chose major because I can find no workaround that an average user could use.

Recording

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.

Description

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 and Slate Info

| | |
|----------------------------------------|-------------|
| Android API Version? | 28 |
| Android Device? | Pixel 2 |
| Physical hardware, or emulated device? | Hardware |
| Which example page? | Plaintext |

Bug: Typing any text throws an exception

Severity

Major

Rationale for severity

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.

Recording

https://imgur.com/mW8zJFO

Description

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 and Slate Info

| | |
|----------------------------------------|-------------|
| 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|

Additional Comments (if any)

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:

https://github.com/ianstormtaylor/slate/issues/2839

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Slapbox picture Slapbox  Â·  3Comments

AlexeiAndreev picture AlexeiAndreev  Â·  3Comments

ianstormtaylor picture ianstormtaylor  Â·  3Comments

JSH3R0 picture JSH3R0  Â·  3Comments

vdms picture vdms  Â·  3Comments