Description
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
- Create a new Maui app
- Modify the MainPage to a Grid container
- Add multiple Grid container one on top of the other (no rows or columns defined)
- Add buttons on each sub-grid. Make sure they are all visible
- Add a background and Opacity set to 0.1 for all sub-grids
- Add Clicked events for each button or add a view model to handle the commands for each button
- Display an alert to automatically see what button is tapped
- 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