Bug 60647 - InputTransparent bug or behavior change in Xamarin.Forms Android 2.4
Summary: InputTransparent bug or behavior change in Xamarin.Forms Android 2.4
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-13 14:52 UTC by j.piechowiak
Modified: 2017-11-14 08:14 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project (41.11 KB, application/x-7z-compressed)
2017-11-13 14:52 UTC, j.piechowiak
Details
Application screenshot (30.72 KB, image/png)
2017-11-13 14:53 UTC, j.piechowiak
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description j.piechowiak 2017-11-13 14:52:47 UTC
Created attachment 25670 [details]
Sample project

In new stable version of XF 2.4 there is bug or behavior change in XF for Android. 
I provided sample application (project and screenshot in attchments). 

In 2.3.4 
When you tap on blue Grid, then one alert is displayed, when you tap on Label with red background, second alert is displayed. This effect is achieved because of usage of InputTransparent property. 

In 2.4 
Wherever you tap, only first alert is displayed. InputTransparent is no longer working like it used to before.

When I switch InputTransparent to False, it works..
In project of our company we use much more complex scenario in which Grid can be dragged into new position. On this grid we have buttons and other controls. And only one thing. With InputTransparent set to true on main grid we can drag content but we cannot tap buttons. With InputTransparent set to false, we can't drag content, but we can tap on buttons.

How can I fix this?
Comment 1 j.piechowiak 2017-11-13 14:53:26 UTC
Created attachment 25671 [details]
Application screenshot
Comment 2 Paul DiPietro [MSFT] 2017-11-13 16:01:51 UTC
The reproduction appears to function as your expectations state on 2.4.0.74863 using both an API 21 and 23 emulator. Tapping the blue background shows one alert, and the red label background the other, so perhaps I'm missing something. What Android version(s) are you seeing this issue on?
Comment 3 j.piechowiak 2017-11-13 18:22:04 UTC
I was testing this on device - Huawei P9 Android 7.0, after full clean and application uninstall. 
When I have installed XF 2.3.4 in this project, flag InputTransparent was set to true in the source code, and it worked fine. 
With the same code but with XF 2.4.0, only worked first alert. Second has never appeared. With XF 2.4.0 to achieve the same effect, I have to switch value of InputTransparent in attached source code to False.
Comment 4 j.piechowiak 2017-11-13 18:26:53 UTC
To sum up, attached code works with following configurations:
XF 2.3.4
InputTransparent = True -> GOOD
InputTransparent = False -> WRONG

XF 2.4.0 
InputTransparent = False -> WRONG
InputTransparent = True -> GOOD

I would like to know, which behaviour is expected one, because the solution from XF 2.4.0 has broken much more complex code in our company.
Comment 5 j.piechowiak 2017-11-13 18:27:40 UTC
*Correct:
XF 2.3.4
InputTransparent = True -> GOOD
InputTransparent = False -> WRONG

XF 2.4.0 
InputTransparent = True -> WRONG
InputTransparent = False -> GOOD
Comment 6 Paul DiPietro [MSFT] 2017-11-13 19:16:46 UTC
I believe that this issue has been brought up before in some form and the answer is that the current 2.4.0 behavior is now correct. There was a disparity in behavior between Android and iOS prior to 2.4.0, and the changes made have brought this in line; referring to the docs on InputTransparency[1]:

"When this property is set on a container class, such as a layout class, its value transfers to child elements. Therefore, setting the InputTransparent property to true on a layout class will result in the elements within the layout not receiving input."

In this case, the grid has InputTransparent set to true, and its value is being passed to the children, so the Label is no longer receiving the tap. iOS functions in the same manner.

[1] https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/#Input_Transparency
Comment 7 j.piechowiak 2017-11-14 08:14:39 UTC
Ok thank you. We will investigate how to handle new approach.