Skip to content

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

@etadzeta

Description

@etadzeta

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions