wordpress-mobile / AztecEditor-Android

A reusable native Android rich text editor component.
Mozilla Public License 2.0
675 stars 112 forks source link

Repeating characters in title #580

Closed supernovia closed 6 years ago

supernovia commented 6 years ago

Expected

If I type "ABCD" in the title box, the title should say "ABCD"

Observed

I type A, it says A. I type B, the title becomes "AAB". I type C, I get "AABABC", etc.

You can see a video and screenshot of the issue in action here: https://cloudup.com/cE18S9bfbWY

Also, note if I add a space, it resets, as you can see in the screenshot. Pressing backspace also does wonky things, but I can eventually clear out the title. I can type normally in the content area and paste to the title area.

Reproduced

  1. Make a new post using the beta editor
  2. Type a title

Note: We were not able to duplicate this on all phones.

Tested

Tested on LG G4, Android 6.0 with alpha 89

designsimply commented 6 years ago

Thank you for reporting this! I tested with Pixel, Android 8.1.0, WPAndroid alpha-90 and was unable to reproduce the problem in my test. Let's see if someone else is able to trigger the problem.

hoverduck commented 6 years ago

I was able to reproduce it with the Swype keyboard, but not with the default Gboard. This isn't the first time we've had a problem with Aztec and non-stock keyboards :confused:

https://github.com/wordpress-mobile/WordPress-Android/issues/5186

maxme commented 6 years ago

Argh ;( this is bad... moving this to high priority.

cc @daniloercoli I wonder if this is a wpandroid issue with the input filter / text watcher recently added for newlines filtering.

cc @rachelmcr very interesting problem to write a test for! No, it's not ;) -and I guess we would need to load a predefined emulator state to test this, it's probably impossible considering the resources we have and I doubt this is available in Firebase or any other cloud service.

daniloercoli commented 6 years ago

Yes @maxme, it could be the culprit, since we're still using Aztec in the Title field of a post in wp-android 🏃 ⛰ It should be the first thing to check when working on this PR, even though we already had similar issues in the past, when we were not using InputFilters, as pointed out by @hoverduck.

maxme commented 6 years ago

FYI: I was using SwiftKeyboard and couldn't reproduce... But yeah I get the same weird behavior with SwypeKeyboard on Android 7.1.1

maxme commented 6 years ago

Fun stuff, Swype and Android Input Filters are not friends: http://forum.swype.com/archive/index.php/t-10398.html

maxme commented 6 years ago

Fixed via https://github.com/wordpress-mobile/WordPress-Android/pull/7021 - replaced the input filter by a text watcher.

maxme commented 6 years ago

Apparently there is no good solution as some virtual keyboards mess with input filters or text watchers. We should just kill this feature (auto removal of newlines), not a big deal if someone add them in the title. cc @daniloercoli @mzorz

We could even have an "offline" way of removing them, when the post is saved for instance.

maxme commented 6 years ago

The fix for #7021 wasn't included in 9.1 - I cherry picked the commit from that fix to the upcoming 9.1.1 version.