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

[Android] Disabled Picker view intercepts GestureRecognizer of parent container #22565

Open
etadzeta opened this issue May 22, 2024 · 4 comments
Labels
area-controls-picker Picker platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@etadzeta
Copy link

Description

For some reason if I have a disabled Picker inside a Grid I cannot use GestureRecognizer attached to Grid (parent container) with Android, it does not fire if I click directly on Picker, so I assume it intercepts with Picker built-in click listener.
In attached screenshot I painted Grid to Red color, and Picker to Gray, and GestureRecognizer is only hit if I click on a Red area.
android
In this example the Grid's GestureRecognizer points to existing method to update the counter and text on the button.

The expected behaviour in short - I should see updated text on a button whenever I click Red or Gray area (parent Grid or Picker view itself), however it does not work on Android. I can trigger GestureRecognizer attached method only if I click directly on Grid (Red area).
Everything works as expected on iOS, the button is updated if I click on any area (Grid or Picker)

Steps to Reproduce

  1. Create a File > New .NET MAUI App
  2. Open MainPage.xaml and add a grid with disabled picker before Button from initial template. Add a GestureRecognizer to Grid poiniting to existing method OnCounterClicked. The file will look like
<?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"
             x:Class="MauiApp1.MainPage">
    <ScrollView>
        <VerticalStackLayout Padding="30,0"
                             Spacing="25">
            <Image Source="dotnet_bot.png"
                   HeightRequest="185"
                   Aspect="AspectFit"
                   SemanticProperties.Description="dot net bot in a race car number eight" />
            <Label Text="Hello, World!"
                   Style="{StaticResource Headline}"
                   SemanticProperties.HeadingLevel="Level1" />
            <Label Text="Welcome to &#xA;.NET Multi-platform App UI"
                   Style="{StaticResource SubHeadline}"
                   SemanticProperties.HeadingLevel="Level2"
                   SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

            <Grid Padding="20"
                  BackgroundColor="DarkRed"
                  HorizontalOptions="FillAndExpand"
                  VerticalOptions="FillAndExpand">
                <Picker BackgroundColor="Gray"
                        IsEnabled="False"
                        VerticalOptions="CenterAndExpand" />
                <Grid.GestureRecognizers>
                    <TapGestureRecognizer Tapped="OnCounterClicked" />
                </Grid.GestureRecognizers>
            </Grid>

            <Button x:Name="CounterBtn"
                    Text="Click me"
                    SemanticProperties.Hint="Counts the number of times you click"
                    Clicked="OnCounterClicked"
                    HorizontalOptions="Fill" />
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>
  1. Click on Picker (Gray area), expected result - button's text is changed with updated counter value.

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android API 34

Did you find any workaround?

No response

Relevant log output

No response

@etadzeta etadzeta added the t/bug Something isn't working label May 22, 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.

@jaosnz-rep jaosnz-rep added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed platform/android 🤖 labels May 22, 2024
@jaosnz-rep
Copy link
Collaborator

Can repro this issue at Android platform on the latest 17.11 Preview 1(8.0.40/8.0.21/8.0.3), and works fine on Windows platform.

@PureWeen
Copy link
Member

@etadzeta if you set InputTransparent to true on the Picker does that let the gesture propagate to the grid?

@PureWeen PureWeen added this to the Backlog milestone May 22, 2024
@etadzeta
Copy link
Author

@PureWeen thanks for the comment, I've tried it and yes it indeed works as expected for disabled Picker. However if I don't set this InputTransparent parameter to true I have correct and expected behaviour in iOS. I still think this is an issue, because in Xamarin such control worked correctly with same settings on both platforms.
For now I'll use this parameter as a workaround, thanks

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-picker Picker 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