Bug 36007 - TapGestureRecognizer Tapped event intermittently not firing
Summary: TapGestureRecognizer Tapped event intermittently not firing
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.5.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-11-18 11:09 UTC by allison.taylor
Modified: 2016-04-13 18:37 UTC (History)
1 user (show)

Tags: ra
Is this bug a regression?: ---
Last known good build:


Attachments
Sample App for TapGestureRecognizer problem (6.43 MB, application/zip)
2015-11-24 15:11 UTC, allison.taylor
Details
Sample Application - Updated to reference Forms version 1.5 (163.28 KB, application/zip)
2015-11-25 11:21 UTC, allison.taylor
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description allison.taylor 2015-11-18 11:09:59 UTC
I have a simple Label with a TapGestureRecongizer.   Tapped event only fires intermittently, and approx 25% of the time on iOS only.   This was a problem on both iOS and Android in Forms version 1.4.4, and was fixed for Android with 1.5.0.   I am still seeing the problem occur on iOS only in Forms 1.5.0.
Comment 1 Samantha Houts [MSFT] 2015-11-19 15:20:35 UTC
Do you happen to have a small reproduction project that I can use to verify that we are fixing the exact issue you are reporting? If not, can you tell me what value you are using for NumberOfTapsRequired, and whether or not you have more than one TapGesture on the Label? Do you see this issue occur mainly when you are tapping quickly in rapid succession? Finally, are you altering the same Label on Tapped, or does the Tapped event do something else?

Thank you!
Comment 2 allison.taylor 2015-11-19 15:36:25 UTC
Hello,   I don't have a reproduction project, but can create one.   In the
meantime I can just answer the questions.
- NumberOfTapsRequired = I have tried both not setting it at all, and
explicitly setting it to 1 - with no noticeable effect.
- Only 1 TapGestureRecognizer is on the Label
- It occurs even if not tapping in rapid succession, e.g., 1 second or more
wait time.
- I am not altering the same Label, the Tapped event handler will make
something else visible/invisible on the same page (but of course the Tapped
event is not firing all the time so this code is not being called).
Thanks!
Comment 3 Samantha Houts [MSFT] 2015-11-20 10:35:35 UTC
Okay, if you could send us a reproduction project, I think it would really help narrow down the problem. Thank you!!
Comment 4 allison.taylor 2015-11-24 15:11:48 UTC
Created attachment 13977 [details]
Sample App for TapGestureRecognizer problem

Here is the requested sample app.  Thanks
Comment 5 allison.taylor 2015-11-24 15:13:38 UTC
Hint - this problem seems only to occur when the Label and it's associated TapGestureRecognizer are on a ContentView.   It did not occur when I tried it on a ContentPage.    
Thanks
Comment 6 Samantha Houts [MSFT] 2015-11-24 18:59:37 UTC
Awesome, thank you! I definitely can reproduce the issue with your test project. I noted that it is using Xamarin.Forms 1.3.3. When I updated to 1.5.0 or later, I no longer saw the issue. Can you confirm if you still see the issue after updating the package on your end? Thanks!!!
Comment 7 allison.taylor 2015-11-25 11:21:25 UTC
Created attachment 13991 [details]
Sample Application - Updated to reference Forms version 1.5

Hello - I updated the version of Forms to 1.5 as requested (new project attached)- the problem still occurs for me on an iPad running iOS 9.1.
Comment 8 Samantha Houts [MSFT] 2015-11-30 18:40:15 UTC
I tested your latest attached project on an iPad running iOS 9.1, and I am still having trouble reproducing the issue. I do notice that tapping directly on the words "Tap here..." do not fire the event, since the iOS status bar is absorbing the event. However, if I click anywhere else within the green label, it consistently fires the event. Also, if I add padding to the grid to shift it away from the status bar, I can click directly on the text and get the event to fire consistently. 

It is only when I have accidentally moved my finger just past the bounds of the label that the event fails to fire. The bounds are pretty strict, and if the tip of my finger taps outside of the bounds of the label before it taps the label, the event doesn't fire. This makes it look as if tapping the label does nothing, but if I am careful to actually touch the label first, it does fire the event.

Does it seem to make a difference if you tap the label in a different location?
Comment 9 allison.taylor 2015-12-01 19:52:20 UTC
Hi Samantha, thanks for the info.   I observed that moving the control with the TapGestureRecognizer away from the iOS status bar DOES help in my reproduction project.   Unfortunately making a similar change in my application is not having any effect.  In the case of my app though, it is being referenced as a custom control which is nested in a bunch of other infrastructure.   I am trying to narrow down the difference between the repro project and my actual app and will get back to you asap!

Thanks!!
Comment 10 allison.taylor 2015-12-04 21:59:51 UTC
Hi Samantha - I found the problem.   The taps are not recognized consistently when the property VerticalOptions = "Center" or "CenterAndExpand" is on the Label with the gesture recognizer.   Other settings for VerticalOptions are fine, but I do want to center the label text.  You can add this one property to my reproduction project and see the problem.  Let me know what you think.  Thanks
Comment 11 Samantha Houts [MSFT] 2015-12-08 18:34:17 UTC
Hmm. I added the VerticalOptions property to the Label with the value Center and then the value CenterAndExpand, and it did not seem to change the behavior on my end. 

<Label Text="Tap Here to Expand/Collapse" BackgroundColor="Green" Grid.Row="0"  VerticalOptions="CenterAndExpand">
        <Label.GestureRecognizers>
          <TapGestureRecognizer  x:Name="tapRec" Tapped="OnExpandCollapse"></TapGestureRecognizer>
        </Label.GestureRecognizers>
</Label>

Did I put it in the correct place?

Thanks!!
Comment 12 Samantha Houts [MSFT] 2016-04-13 18:37:49 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team