Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click event fired even when button has views on top of it #22442

Closed
nk-alex opened this issue May 16, 2024 · 4 comments
Closed

Click event fired even when button has views on top of it #22442

nk-alex opened this issue May 16, 2024 · 4 comments
Labels
area-controls-button Button, ImageButton platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@nk-alex
Copy link

nk-alex commented May 16, 2024

Description

  • Having two views (A and B), view A on top of B.
  • Place in view B a button or whatever control with gesture recognizer.
  • When you click on screen, the tap or click event from view B is still raised.
  • Since view A is on top, view B shouldn't be raising the click event.
  • Even if view A is an ActivityIndicator, click still goes through it.

Steps to Reproduce

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             Title="{Binding Title}"
             x:Class="MyApp.Views.MainPage">

	<Grid>
		<Button Text="Click me" Clicked="Button_Clicked"/>

		<Grid BackgroundColor="Red">
			<Grid.RowDefinitions>
				<RowDefinition Height="*"/>
				<RowDefinition Height="200"/>
				<RowDefinition Height="*"/>
			</Grid.RowDefinitions>

			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="200"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
		</Grid>
	</Grid>
</ContentPage>

Link to public reproduction project repository

No response

Version with bug

8.0.21 SR4.1

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

android 21

Did you find any workaround?

Make the view on top have any type of gesture recognizer itself. In this sample it's a tap gesture, but also works with swipe gesture. Although I don't think this workaround is really viable.

<Grid>
	<Button Text="Click me" Clicked="Button_Clicked"/>

	<Grid BackgroundColor="Red">
		<Grid.GestureRecognizers>
			<TapGestureRecognizer NumberOfTapsRequired="1" Tapped="TapGestureRecognizer_Tapped"/>
		</Grid.GestureRecognizers>
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="200"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
			<ColumnDefinition Width="200"/>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
	</Grid>
</Grid>

Relevant log output

No response

@nk-alex nk-alex added the t/bug Something isn't working label May 16, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@nk-alex
Copy link
Author

nk-alex commented May 16, 2024

Duplicate of #12014

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 16, 2024
@kevinxufei
Copy link
Collaborator

Can repro this issue at Android platform on the latest 17.10 Preview 7(8.0.21/8.0.40).

@mattleibow
Copy link
Member

Duplicate of #10252

@mattleibow mattleibow marked this as a duplicate of #10252 May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-button Button, ImageButton platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants