maui icon indicating copy to clipboard operation
maui copied to clipboard

TapGestureRecognizer not working if child element has InputTransparent = "True"

Open gktval opened this issue 3 years ago • 2 comments

Description

If InputTransparent is set to true, it should pass inputs such as TapGestures to it's parent control. https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.visualelement.inputtransparent?view=xamarin-forms

However, if set to true, parent controls do not receive TapGestures.

Below is a code example. The label within the StackLayout has InputTransparent="True". However, when tapping the label, the input gesture is not passed to the parent visual element (the StackLayout).

Steps to Reproduce

Here is the code to reproduce the issue.

<StackLayout  Orientation="Horizontal"  
                     HorizontalOptions="FillAndExpand"  
                     VerticalOptions="FillAndExpand">

            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
            </StackLayout.GestureRecognizers>

            <Label Text="Test"  InputTransparent="True" />

<StackLayout/>

In .cs code:

 private void TapGestureRecognizer_Tapped(object sender, System.EventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("Tapped");
    }

Link to public reproduction project repository

na

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Windows 11

Did you find any workaround?

No response

Relevant log output

No response

gktval avatar Sep 19 '22 19:09 gktval

Did you try setting InputTransparent to false on your parent control?

AmSmart avatar Sep 20 '22 23:09 AmSmart

Did you try setting InputTransparent to false on your parent control?

By default InputTransparent is false. The code is exactly as shown above in the example. So the stack panel has InputTransparent set as false already.

gktval avatar Sep 21 '22 17:09 gktval

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Sep 23 '22 14:09 ghost

Related https://github.com/dotnet/maui/issues/10252

PureWeen avatar Sep 23 '22 14:09 PureWeen

This appears to be working on all platforms with maui 7.0.59.

mattleibow avatar May 02 '23 02:05 mattleibow

Hi @gktval. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar May 02 '23 02:05 ghost

It is working on 7.0.59. The latest release 7.0.81 is not working. I am guessing that is because of this https://github.com/dotnet/maui/pull/14669 I will check if this is working after the next release.

gktval avatar May 02 '23 14:05 gktval

I tested it on 7.0.86 and it still has the same error.

pierrebrito avatar May 10 '23 13:05 pierrebrito

I tested it on 7.0.86 and it still has the same error.

This is working for me in 7.0.86. Do you want to post an example where it does not work? Otherwise I will close this.

gktval avatar May 11 '23 13:05 gktval