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

Tap Events Incorrectly passed Through Button #26640

Open
david-maw opened this issue Dec 15, 2024 · 4 comments · May be fixed by #26834
Open

Tap Events Incorrectly passed Through Button #26640

david-maw opened this issue Dec 15, 2024 · 4 comments · May be fixed by #26834
Labels
area-gestures Gesture types partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@david-maw
Copy link

Description

Clicks are passed through a button to the underlying control, for example using this XAML:

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="Clear Log" Command="{Binding ClearLogCommand}"/>
    </ContentPage.ToolbarItems>
    <Grid>
        <Grid.GestureRecognizers>
            <TapGestureRecognizer 
                CommandParameter="On Page Root (Grid)"
                Command="{Binding ShowTapCommand}"/>
        </Grid.GestureRecognizers>

        <Border Padding="2">
            <Label Text="{Binding CommandLog, TargetNullValue='No events logged' }" FontSize="Micro"/>
        </Border>
        <Button Text="Clear Log" Command="{Binding ClearLogCommand}" VerticalOptions="End"/>
    </Grid>

Tapping anywhere on the page will log an event on the page, tapping the button, or the ToolBar item, should clear the log page but tapping the button ALSO registers a tap on the page.

It works correctly on Android or using Microsoft.Maui.Controls Version 9.0.14, it just fails on 9.0.21.

Steps to Reproduce

  1. Clone the repository, build and run the app on Windows
  2. Tap on the center of the page and a Tap will be logged
  3. Tap on the toolbar item and the log will be cleared and a message written to it to that effect.
  4. Tap on the button and the log will be cleared but ALSO a tap on the page will be logged.
  5. Repeat on Android or with an earlier Microsoft.Maui.Controls and tapping the button will just clear the log, as expected.

Link to public reproduction project repository

https://github.com/david-maw/SimpleCollectionView-Propagation.git

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.14 SR1.4

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Windows 11

Did you find any workaround?

No

Relevant log output

@david-maw david-maw added the t/bug Something isn't working label Dec 15, 2024
@jfversluis jfversluis added area-gestures Gesture types potential-regression This issue described a possible regression on a currently supported version., verification pending labels Dec 16, 2024
@jfversluis jfversluis added this to the .NET 9 Servicing milestone Dec 16, 2024
@ninachen03 ninachen03 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Dec 16, 2024
@ninachen03
Copy link

This issue has been verified using Visual Studio 17.13.0 Preview 2.0 (9.0.21 & 9.0.14 & 8.0.100 & 8.0.71) can repro it on Android/Windows Platform.
Image

@NirmalKumarYuvaraj
Copy link
Contributor

In PR #25311 ,MAUI has recently implemented a fix to trigger the tap event for controls using a gesture recognizer. Based on this implementation, the reported issue appears to be a behavior originating from the native side. I have shared a video and code snippet for reference.

<StackPanel IsTapEnabled="True" Tapped="StackPanel_Tapped" Orientation="Horizontal" HorizontalAlignment="Center" Background="red" Height="500" Width="500" VerticalAlignment="Center">
     <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
WInui.mp4

@daltzctr
Copy link
Contributor

This also affects our application. If this is intentional behavior, is there a way to selectively disable this behavior?

Imagine you have some view that looks like the following. You want tapping on this view to navigate to a device, but you want tapping on the checkbox to not navigate, but select the checkbox. You may ask, why don't you make the bottom region a clickable zone. From a user's perspective (and a mobile perspective), they would expect all text, images, etc to allow navigation, but the checkbox to not navigate.

Image

@MartyIX
Copy link
Contributor

MartyIX commented Dec 26, 2024

This issue affects our app as well.


@NirmalKumarYuvaraj Not really an expert but this line

_container.AddHandler(FrameworkElement.TappedEvent,_tappedEventHandler, true);

seems suspicious to me. Is the true correct? Or should one use this implementation only for certain controls? IDK.

Image

edit: I tested changing

-_container.AddHandler(FrameworkElement.TappedEvent, _tappedEventHandler, true);
+_container.AddHandler(FrameworkElement.TappedEvent, _tappedEventHandler, false);

and it does not work. So no, that's not the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-gestures Gesture types partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 platform/windows 🪟 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

Successfully merging a pull request may close this issue.

7 participants