Skip to content

Android Maui tap event pass through containers #29920

Open
@mmuresan

Description

@mmuresan

Description

In Maui Android, the Touch event is passing through any container, such as Grid, StackLayout, BoxView and so on, as long as there is no TapGestureRecognizer attached to the container.
In Windows this is not happening.
This is an inconsistent behavior in Maui, between platforms

Steps to Reproduce

  1. Create a new Maui app
  2. Modify the MainPage to a Grid container
  3. Add multiple Grid container one on top of the other (no rows or columns defined)
  4. Add buttons on each sub-grid. Make sure they are all visible
  5. Add a background and Opacity set to 0.1 for all sub-grids
  6. Add Clicked events for each button or add a view model to handle the commands for each button
  7. Display an alert to automatically see what button is tapped
  8. Tap any of the buttons

In Android only:
Observe that the buttons can be tapped, no matter what layer (Grid) is the button contained in
In Windows, this is not happening.

Expected to have a consistent behavior in all platforms

Link to public reproduction project repository

https://github.com/mmuresan/androidmauitouchthroughbug

Version with bug

9.0.70 SR7

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All supported Android platforms

Did you find any workaround?

The only workaround is to add in the top grid, under any control contained in that grid, a BoxView control and attach a TapGestureRecognizer to that BoxView control. This way it will catch all taps that are not directly over a control, such as buttons, Entry, and so on.

Relevant log output

No log required

Metadata

Metadata

Assignees

No one assigned

    Labels

    partner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions