cryptee / web-client

Cryptee's web client source code for all platforms.
https://crypt.ee
Other
444 stars 22 forks source link

[Bug] Android 6 cursor does not follow user input, if the text input is behind the soft-keyboard. #126

Closed quenousimporte closed 3 years ago

quenousimporte commented 3 years ago

Describe the bug I came across this strange behavior while trying to ghost a folder from my Android device: I type the folder's name (but cannot see what I type because of the virtual keyboard), then get an error "Please type this folder's name exactly as it is...." And when I reduce the keyboard to see what I typed, the text is written from right to left! 👻 This behavior is systematic on my phone.

For instance, "Fantôme" becomes "emôtnaF". Please see screenshots bellow.

To Reproduce Steps to reproduce the behavior:

  1. Try to ghost a folder from an Android phone, for instance "Fantôme"
  2. Close the error message
  3. Reduce the keyboard
  4. See the folder's name field with "emôtnaF"

Screenshots Typing the folder's name without seeing what I type: image

Error message: image

Then I reduce the keyboard and behold: image

System Information:

johnozbay commented 3 years ago

Hi there!

Thanks a million for filing this!

This bug gave us some good, long and confused head-scratches trying to figure out the root cause. And thanks to our sponsor browserstack (had to plug their amazing service and sponsorship here hahah) we figured it out. This is a fun one, grab some popcorn.

First – Congrats you've found an Android 6 bug. 🎉 And a super weird one at that! Thankfully Google seems to have fixed this in Android 7.

So here's what's going on. Using the on-screen soft-keyboard, if you type into an input box that's behind the keyboard, Android 6 seems to lose cursor position, and always type at the beginning of the input box. So you keep typing, but the cursor never moves. So if you're typing "Home", the text and cursor looks like this :

| H | oH | moH | emoH

But it's actually not right-to-left. How do I know? Thanks to our sponsor Browserstack 😅


We tested the scenario on a real Nexus 6 running Android 6 and latest Chrome, it looks like this :

https://user-images.githubusercontent.com/611338/121858613-78c78300-ccff-11eb-858f-0d5a0f57c3e9.mov

If you close the soft keyboard, but use a USB keyboard, then you can see that the cursor can follow along, and text is actually correctly left-to-right. But if you type with the soft-keyboard, cursor sits still.


So we thought ... and wondered if this is a soft-keyboard specific bug about input visibility, or a cursor bug that would happen even with USB keyboards etc. So we did more tests.

We built an updated version of the same modal, removed everything else in the ghost modal, so that the input field is visible and above the soft keyboard this time.

https://user-images.githubusercontent.com/611338/121858908-c5ab5980-ccff-11eb-86d0-e81c9eb44078.mov

🎉 🤯
mind. blown.

So that confirmed the theory. it's about the input field being behind the soft keyboard.


But we still had one more test to do to find out whether if / when Google fixed this bug. So I present to you Nexus 6P running Android 7 :

https://user-images.githubusercontent.com/611338/121859365-4b2f0980-cd00-11eb-9e33-e0f27d4021fa.mov

Thankfully, it seems Google indeed fixed this bug in Android 7.


So I'd say this is a 50-50 bug where both Google and we are equally responsible. We'll try our best to design things better so that input boxes are never behind the keyboard, and hopefully this should address some of these issues for devices running Android 6.

But I think you may run into other / similar issues like this one every now and then. Android 6 is ~7 years old now, and hasn't gotten many security updates since ~2016 - 2017 as far as I know. So you're running a device that has major security issues commonly exploited in the wild, that are at least 5-year old. For your own safety and security I'd strongly recommend updating to a newer Android device if you can, when you can.

If not – don't worry, I promise we'll continue to support older devices as long as we possibly can. In fact you can probably continue to use Android 6, and we'll likely be able to support it for years and years more to come. Personally I'm incredibly happy that we can support all the way down to Android 6 in the first place. (albeit with occasional bugs like this one) On iOS browser updates are tied to OS updates 🤦🏻‍♂️ So we actually can't support anything below ~iOS 11 due to some in-browser encryption related features we need which older versions of Safari doesn't support.


We're going to go through our entire design on smaller screens this week, and figure out where else this bug may occur due to limited screen real-estate, and fix as many of these as we possibly can. (for example we can that see this happens in Rename Folder as well)

But unfortunately there's only so much we can do. Since there's very limited space on screens, and if you add the fact that some browsers have bigger address bars, some users use taller keyboards for accessibility, or the fact that some users use entirely different 3rd party soft-keyboards that maybe even taller, and android vendors may have different keyboards and screen sizes etc, we cannot confidently say "yep we totally fixed this". At the end of the day, it's actually Android's job to move the input box higher up so you can see what you're typing. Or at least make sure your cursor indeed does move forward while typing 😅

So for now, I'll close this bug. But if you run into this (or bugs like this in any other part of the app), and if you have time, please report it here. We'll do our best to address as many as we can.

Thanks a million once again for filing this one! Deeply appreciate you taking the time in helping us make Cryptee better! 🙏🏻

Best, John

quenousimporte commented 3 years ago

Wow, thank you so much for having checked this issue so thoroughly! I'm really impressed 😊

I know that I use an old device, and I expect to meet some problems sometimes. But it didn't occur to me that this one could be related to my Android version. Very interesting! I'll think about upgrading some day.

I know that Android versions are fragmented and it must be a hell for you guys...

Thanks again! Keep it up!

johnozbay commented 3 years ago

You're so very welcome! ✌🏻 I'm glad we could figure it out in the first place.

We also support right-to-left languages in Cryptee Docs, (so you can write in French then switch to Hebrew or Arabic in the same document for example) – so when we saw your bug report about how the text appears RTL, we were like "hoooolyyy shit we broke something reaaallly badly in the RTL/LTR toggle switch" hahahah (thankfully it wasn't about this feature)

Android is fragmented, but it's actually much much much better than iOS & Safari. On Android, even if you have Android 6, you can still get the latest Firefox or Chrome etc. (Like the way you're using Chromium 91 for example) So we actually don't need to do too much testing, as long as we can make sure Cryptee works on the latest Chrome & Firefox, and perhaps still compatible with a few versions behind (let's say a few months or so) we're actually good to go.

Safari on iOS on the other hand ... It's basically the new IE ... Safari only updates with operating system updates. So for example if you're using an iPhone 6, you're stuck on iOS 12, and that means you're stuck on Safari 12, released in 2018, and never got an update since. So you're running a 3 year old browser, which is WAAAAYYY more dangerous than running an older operating system. Because your browser is your first line of defence. If you visit a malicious website, they can utilise security holes in your 3 year old browser and hack your device etc. (heck you can jailbreak and root an older iphone by visiting a website on older devices... you do the math... )

And to add insult to the injury, Apple requires all browsers in the iOS app store (incl Chrome / Firefox etc) to use Apple's WebKit engine. So all browsers on iOS are essentially Safari under-the-hood, but simply have different cosmetic looks / features such as sync'ing your chrome bookmarks etc. But the engine is still the same old broken Safari.

Basically Apple intentionally cripples the web to sell more apps and profit 30% off of them. Android is a joy to work with (despite a few bugs here and there) Hahahha

Anyhow, thanks a million once again✌🏻 Learned something new today!

Best, J