maui
maui copied to clipboard
TapGestureRecognizer not working if child element has InputTransparent = "True"
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
Did you try setting InputTransparent to false on your parent control?
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.
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.
Related https://github.com/dotnet/maui/issues/10252
This appears to be working on all platforms with maui 7.0.59.
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.
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.
I tested it on 7.0.86 and it still has the same error.
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.