Bug 45453 - BoxView does not receive Touch events on Android unless InputTransparent is set to true
Summary: BoxView does not receive Touch events on Android unless InputTransparent is s...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-10-14 15:47 UTC by John Miller [MSFT]
Modified: 2018-04-24 18:03 UTC (History)
7 users (show)

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


Attachments
Sample Project (50.24 KB, application/zip)
2016-10-14 15:47 UTC, John Miller [MSFT]
Details
Repro demonstrating the Label and BoxView InputTransparent settings on a single screen (278.21 KB, application/x-zip-compressed)
2016-10-21 22:42 UTC, E.Z. Hart [MSFT]
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 FIXED

Description John Miller [MSFT] 2016-10-14 15:47:10 UTC
**Overview**:

BoxView does not receive Touch events on Android unless InputTransparent is set to true.

**Steps to Reproduce**:

Run the attached sample on Android and touch the green box. 

**Actual Results**:

The event handler in the renderer does not fire.

**Expected Results**:

The event handler in the renderer should fire, and the output should have a Testing log.

**Build Date & Platform**:

XF 2.3

**Additional Information**:

Might be related to this: https://bugzilla.xamarin.com/show_bug.cgi?id=33664
Comment 1 John Miller [MSFT] 2016-10-14 15:47:57 UTC
Created attachment 18048 [details]
Sample Project
Comment 3 adrianknight89 2016-10-16 05:36:07 UTC
I don't see this problem. I'm testing this on the master branch as of commit 92d4627. It could be tested again in the next release.
Comment 4 E.Z. Hart [MSFT] 2016-10-21 22:41:47 UTC
When InputTransparent is set to false, the BoxView is supposed to prevent gestures from being passed through to the controls below it. This is not necessarily true of all controls; Labels, for example, pass through gestures regardless. 

At the moment, Android is the only platform which is handling this correctly; on Windows and iOS, the BoxView is passing gestures through regardless of the InputTransparent setting.
Comment 5 E.Z. Hart [MSFT] 2016-10-21 22:42:38 UTC
Created attachment 18176 [details]
Repro demonstrating the Label and BoxView InputTransparent settings on a single screen
Comment 6 E.Z. Hart [MSFT] 2016-10-21 22:42:53 UTC
In other words, this is a bug, but it's a bug in Windows and iOS.
Comment 7 adrianknight89 2016-10-24 05:55:40 UTC
Sorry, I'd only tested Android.

There seems to be a discrepancy between Android and iOS. I have run some tests with the following markup:

<Grid>
    <Grid.GestureRecognizers>
      <TapGestureRecognizer Tapped="TapGestureRecognizer_OnTapped"></TapGestureRecognizer>
    </Grid.GestureRecognizers>
    
    <ContentView BackgroundColor="Aqua" WidthRequest="100" HeightRequest="100" HorizontalOptions="Center" VerticalOptions="Center">
      <ContentView.GestureRecognizers>
        <TapGestureRecognizer Tapped="TapGestureRecognizer_OnTapped2"></TapGestureRecognizer>
      </ContentView.GestureRecognizers>
    </ContentView>
</Grid>

- When you tap on the ContentView, this will trigger the second handler on both iOS and Android. This behavior is consistent.

- If you set InputTransparent to true on the ContentView, both Android and iOS will run the handler for the grid. This behavior is consistent.

- If you disable the ContentView, Android does not trigger either of the handlers. iOS will pass the touch to the Grid, so Android blocks whereas iOS ignores.

Now remove the tap gesture from the ContentView and test against the same cases:

- Android does not run the handler for the Grid whereas iOS does.

- Both run the handler for the Grid. This behavior is consistent.

- Android does not run the handler for the Grid whereas iOS does.

So, this issue is not related to BoxView. I suspect that it applies to all visual elements. Also, the inconsistencies are beyond what is described in the bug report.
Comment 8 adrianknight89 2016-10-24 06:02:51 UTC
I like Android's approach, so maybe we can work on bringing other platforms on par with Android.
Comment 9 David Ortinau [MSFT] 2017-06-16 19:57:50 UTC
This is addressed by https://github.com/xamarin/Xamarin.Forms/pull/842