Search Unity

Keyboard doesn't show up on Android 11 when the input field is hidden

Discussion in 'Android' started by JuliusM, Sep 28, 2020.

  1. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Currently using hide input field option prevents the on-screen keyboard from showing up on devices with Android 11. We are making the quick workaround by changing how the input field is hidden. After the workaround is implemented, the input field as well as the text in it will be transparent. That is not an ideal solution, but it's the fastest and safest fix for now.
    We are planning to make the fix in all currently supported Unity versions.
    The issue can be tracked here https://issuetracker.unity3d.com/is...-with-hide-mobile-input-checked-on-android-11

    Edit: The fix was made in these Unity versions: 2018.4.29f1, 2019.4.13f1, 2020.1.11f1 and 2020.2.0b10.
     
    Last edited: Nov 4, 2020
    Gasiek and jhocking-bundlar like this.
  2. justin_bling

    justin_bling

    Joined:
    Oct 24, 2019
    Posts:
    3
    Is there an ETA on this workaround?
     
  3. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    112
    Gasiek likes this.
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
  5. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    The issue gets marked as resolved in the issue tracker when the QA verifies it. That means there can still be a period of time when the issue is marked resolved, but the version which contains the fix is not yet released.

    As Tomas has said, for 2018LTS the fix will be available with 2018.4.29f1. The fix was also made in 2019.4.13f1, 2020.1.11f1 and 2020.2.0b10.
     
    andersemil likes this.
  6. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    112
    My bad, sorry, I misread the release notes of 2018.4.28 ... it lists it as a known issue, I read it as a fix.
     
  7. leedan_johnson

    leedan_johnson

    Joined:
    Jun 17, 2019
    Posts:
    6
    I'm going to challenge the acceptability of the workaround Unity has used to circumvent the issue.

    A) The input field is not completely hidden. The following images demonstrate underlining and highlighting still being shown just above the keyboard with the 'hidden' input field.
    https://drive.google.com/file/d/1HVq88wVnpTuktaJ3_quXc_WEZxyo0xha/view?usp=sharing
    https://drive.google.com/file/d/1HSlk1-7ewW5l99tani5v8jSvBxnjGlXp/view?usp=sharing
    https://drive.google.com/file/d/1HYC0OfKnZtBSlXo0uGpI89893E0icNy8/view?usp=sharing

    B) The 'hidden' input field still blocks raycasts, preventing touches from propagating to the intended target. This has caused a significant number of issues for clients, as they are unable to interact with the app as expected. The effect is minimal with short strings, but long inputs can block touches over a significant portion of the screen. This can be seen in second image above as it prevents the buttons from being pressable.
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Which Unity version do you use and on which device do you see this behavior? Does it happen on other devices as well? From what I remember, it should not be possible to interact with the game elements while the keyboard is open, so these issues would not happen. There was one device that was working differently (I can't remember which one now), but everything else that our QA tested behaved the same. Maybe this behavior is present only in Unity 2019 and up.
     
  9. leedan_johnson

    leedan_johnson

    Joined:
    Jun 17, 2019
    Posts:
    6
    We're currently using 2019.4.15f1. The visible artifacts are present on my Samsung Galaxy S8, and I suspect the keyboard I'm using (Fleksy) may be partially to blame for the visible highlighting.

    Historically (on Android) the first tap on the screen when the keyboard is active will not interact with onscreen elements, but it does serve to dismiss the keyboard. This two tap process is an unpleasant user experience issue on it's own, but at least in this scenario, a user trying to tap one of the buttons in the previous photo may have to tap twice, but they would be able to tap the button and perform the action. The new hidden input field blocks touches from dismissing the keyboard as our users have come to expect, and so they would have to tap elsewhere on the screen (outside of the area blocked by the transparent text field) to dismiss the keyboard, before being able to tap the button.
     
  10. leedan_johnson

    leedan_johnson

    Joined:
    Jun 17, 2019
    Posts:
    6
    Still haven't heard anything back on this, and we continue to receive customer complaints. Is this issue going to be addressed?
     
  11. RobinopdeBeek

    RobinopdeBeek

    Joined:
    Jan 17, 2018
    Posts:
    23
    I agree with @leedan_unity. I have been waiting for a fix for this for a long long time now. The 'fix' where simply not rendering the input field is terrible! It's still super messy in 2020.1.16f1 and simply unusable. It blocks raycasts and you can still select stuff in the invisible input field. I have attached a screenshot of the issue.
    https://drive.google.com/file/d/1HzBuSUmU4MQnavZLEHT09tlrWylUwvzq/view?usp=sharing

    Isn't an input field one of the most basic things you can have in an app? Why is it so hard to get this right?

    Edit: The screenshot is from a Pixel 2.

    Edit: Also tested it on 2020.2.1 but has the same issue (Pixel 2). Here another screenshot:
    https://drive.google.com/file/d/17dVXJq0DtdIoheSRH7r80qc2v6irLxpA/view?usp=sharing
     
    Last edited: Jan 14, 2021
  12. RobinopdeBeek

    RobinopdeBeek

    Joined:
    Jan 17, 2018
    Posts:
    23
  13. leedan_johnson

    leedan_johnson

    Joined:
    Jun 17, 2019
    Posts:
    6
    I really don't think issues like this should be considered resolved until they are backported to all active LTS distributions. The problem is NOT fixed for us, and we've been receiving customer complaints for 9 months. Issues like this that appear to completely fall off Unity team's radar have us seriously considering migration to another platform.
     
  14. faculoyarte

    faculoyarte

    Joined:
    Nov 1, 2018
    Posts:
    3
    We are having this issue on Unity 2019.3.13 with TextMeshPro on Android 11. On some devices get fixed by unchecking Hide Mobile Input. Users must be logged in to use the app...
     
  15. unity_WHU2VAI6_H7PFg

    unity_WHU2VAI6_H7PFg

    Joined:
    Nov 19, 2019
    Posts:
    14
    This workaround is not working in 2019.3.15f1. Please fix it!!
     
  16. str3lok

    str3lok

    Joined:
    May 27, 2012
    Posts:
    24
    Confirm.
    Previously, there was a bug in the engine that the keyboard is not displayed on some Android devices. You fixed it in Unity version 2019.4.13. To get the fix, I upgraded to version 2019.4.29f1. After that, a bug appeared that there is a small area above the keyboard that does not catch touches in the UI.
    At the same time, in the Google report, it seems like it is even marked as content without a label. Here is an example of his screenshots.

    Images:
    https://ibb.co/HnbjrzC moto e5 play, Android 8.1 (SDK 27)
    https://ibb.co/JtXVhkM Galaxy S9, Android 8.0 (SDK 26)
     
  17. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Hi Julius and Tomas, unfortunately the issues described by others above (underlining showing up and the input field blocking click raycasting) are still happening with TouchScreenKeyboard.hideInput. In addition, clicking in the area of the input field while the keyboard is open is triggering a cascade of errors closing the keyboard completely.

    I submitted a new bug report and posted a thread summarizing what I am seeing here.

    Would you guys be able to take another look at the issue with current devices and current Android/Unity versions? I have been using a Samsung S21+.

    If you do not have the time or resources to work on a solution currently, would you be willing to share the Android code you are using in Unity with TouchScreenKeyboard.hideInput so we can try to modify it ourselves into something that might work?

    Or at least let us know how to access the input field so we can try to experiment. For example, in Unity, I can get keyboard height with:

    Code (csharp):
    1. #if UNITY_ANDROID && !UNITY_EDITOR
    2.  
    3.         using (AndroidJavaClass UnityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    4.         {
    5.             AndroidJavaObject View = UnityClass.GetStatic<AndroidJavaObject>("currentActivity").Get<AndroidJavaObject>("mUnityPlayer").Call<AndroidJavaObject>("getView");
    6.  
    7.             using(AndroidJavaObject Rct = new AndroidJavaObject("android.graphics.Rect"))
    8.             {
    9.                 View.Call("getWindowVisibleDisplayFrame", Rct);
    10.                 int freeHeightInRawScreenPixels = Rct.Call<int>("height");
    11.                 return (int)((Screen.height - freeHeightInRawScreenPixels) * scalingFactor);
    12.             }
    13.         }
    If you could share with us any basic method to similarly find and access the input field perhaps we can all work together on finding a solution. Presumably, the ideal solution would be to move it off screen by shifting it by several thousand in any direction.

    Alternatively, we will need some way to hide the underlining that is still showing up from it and stop it from catching clicks and creating errors.

    Thanks for any help you can provide. I think many of us very much do need this function. It's critical for me certainly and I don't mind digging through Android documentation or experimenting to help find a solution if you can provide a starting hint for me to work from.
     
  18. mridulacetpa

    mridulacetpa

    Joined:
    Jan 30, 2023
    Posts:
    1
    The keyboard not showing up when the input field is hidden on Android 11 is likely due to a bug in the operating system. This bug is known to cause input fields to become invisible to the operating system and prevent the keyboard from popping up. Unfortunately, there is no known workaround for this issue at this time. However, the Android team is aware of the issue and is likely working on a solution. For now, you may have to wait until a patch is released to fix the issue.