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

TapGestureRecognizer disregards parent's IsEnabled status on iOS and Catalyst. #18995

Closed
derlidio opened this issue Nov 23, 2023 · 6 comments · Fixed by #23049
Closed

TapGestureRecognizer disregards parent's IsEnabled status on iOS and Catalyst. #18995

derlidio opened this issue Nov 23, 2023 · 6 comments · Fixed by #23049
Labels
area-gestures Gesture types fixed-in-8.0.70 fixed-in-9.0.0-preview.6.24327.7 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@derlidio
Copy link

Description

A TapGestureRecognizer will not obey the IsEnabled status of its parent on iOS and Catalyst. It will register touch actions and trigger its Tapped method. Do not happen on Android. Not tested on Windows.

Steps to Reproduce

  1. Clone the attached repo
  2. Build and Run on iOS Simulator or Catalyst

The "Click me too" button (composed by a Grid, a BoxView and a Label) under the normal Button should not be clickable, but it is.

Link to public reproduction project repository

https://github.com/derlidio/TapGestureBug.git

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 17, macOS Sonoma 14.1.1 (23B81)

Did you find any workaround?

No workaround besides checking for the control IsEnabled state on it's Tapped method.

Relevant log output

No response

@derlidio derlidio added the t/bug Something isn't working label Nov 23, 2023
@NXDMN
Copy link

NXDMN commented Nov 24, 2023

Same here. I use InputTransparent to workaround

Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(VisualElement.IsEnabled), (handler, view) =>
{
    (view as VisualElement).InputTransparent = !view.IsEnabled;
});

@tjiakwokyung28
Copy link

tapgesture in net 7 better than net 8, net 8 many having problem

@mattleibow mattleibow added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Nov 30, 2023
@mattleibow mattleibow added this to the Backlog milestone Nov 30, 2023
@ghost
Copy link

ghost commented Nov 30, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@metalium84
Copy link

I'm facing the same issue within a DataTemplate.
Parents with disregarded IsEnabled properties I found: Grid, Frame
Parent with regarded IsEnabled property: ViewCell

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Dec 28, 2023
@XamlTest
Copy link

XamlTest commented Dec 28, 2023

Verified this on Visual Studio Enterprise 17.9.0 Preview 2(8.0.3). Repro on iOS 17.0 and MacCatalyst, not repro on Windows 11 and Android 14.0-API34 with below Project:
TapGestureBug.zip

Screen.Recording.2023-12-28.at.4.57.09.PM.mov

@BlotskiyDmitriy
Copy link

This problem is still relevant. I noticed that it plays on all platforms except Android. I also studied and noticed that on all these platforms except Android, IsEnabled is not implemented in the gesture class.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-gestures Gesture types fixed-in-8.0.70 fixed-in-9.0.0-preview.6.24327.7 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 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.

9 participants