Bug 59863 - TapGestureRecognizer extremely finicky
Summary: TapGestureRecognizer extremely finicky
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.4.0
Hardware: PC Windows
: Highest major
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
: 60208 60341 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-29 17:27 UTC by Philipp Sumi
Modified: 2018-01-03 16:39 UTC (History)
21 users (show)

Tags: ac, android, tapgesture, fr
Is this bug a regression?: Yes
Last known good build:


Attachments
Reproduction attempt (300.03 KB, application/x-zip-compressed)
2017-10-04 22:04 UTC, E.Z. Hart [MSFT]
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 FIXED

Description Philipp Sumi 2017-09-29 17:27:48 UTC
I noticed that after upgrading to 2.4.0, it's really hard to trigger a tap command on my ContentViews that use a GestureRecognizer. Turns out that if my taps are "micro-swipes" (which happens when the finger doesn't come in a 90 degree angle) and not extremely short, they don't register as taps anymore. The difference to 2.3.4. or earlier versions is extremely obvious - I initially thought my event handlers were broken because the taps didn't register at all for the first 5-10 times I tapped.
Comment 1 Paul DiPietro [MSFT] 2017-09-29 17:33:19 UTC
Could you please upload a reproduction?
Comment 2 Paul DiPietro [MSFT] 2017-09-29 20:54:11 UTC
Might be the same thing as the newer #59873.
Comment 3 post4me3 2017-10-03 22:47:45 UTC
Guys , this is critical. 

I'm experiencing this issue as well. I have lots of tap gesture recognizers and they just do not fire since upgrading to 2.4.0.282. This is only on ANDROID. iOS its fine.

Sometimes they fire after 2-8 taps. I have a variety of Gesture recognizers attached to labels, images etc , nested in TableViews, StackLayouts, Grids, ScrollViews  etc - all of these are affected.

There isnt any pattern or anything fancy we are doing, just your bog standard TapGesture's added in XAML like :


<controlExtensions:MyLabel
                            Margin="40,0,0,0"
                            HeightRequest="40"
                            HorizontalOptions="CenterAndExpand"
                           
                            Text="Click Me"
                            VerticalTextAlignment="Center"
                            WidthRequest="60">

                            <controlExtensions:MyLabel.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding MyCommand}" />
                            </controlExtensions:LabelExt.GestureRecognizers>
</controlExtensions:MyLabel>

So basically pretty much our entire codebase that uses extensively TapGesture recognizers behind :

- StackLayouts
- Grids
- Labels
- Images

etc are affected ...

This means that now, when we use AbsoluteLayouts to act as a veneer when we have a long running process and then allow the user to touch the AbsoluteLayout via a TAP Gesture - the TAPS dont fire ... I had to TAP like 10 times ???

Also, We use Prism with Popup windows whereby to dismiss the popup window, we can touch anywhere on the parent - this doesnt work at all ... The only way to dismiss the popup is to press the hardware back button. 

I find it staggering that this wasnt tested with this important XF release ????
Comment 4 E.Z. Hart [MSFT] 2017-10-04 22:04:49 UTC
Created attachment 25115 [details]
Reproduction attempt

post4me3,

I've attempted to reproduce the problem in the attached project using XAML similar to what you posted. So far, everything appears to work just fine. I'm using XF 2.4.0.282 and v25.4.0.2 of the Android support libraries. I've run the project on a Nexus 6 and a Samsung Galaxy Tab 3, and the command consistently fires when I tap the Label.

Does the attached project work for you? If it does, is there something I'm missing in my layout to reproduce this issue?
Comment 5 post4me3 2017-10-05 15:30:34 UTC
@E.Z.Hart - Have sent you email with a repo project and video that shows the gestures used.
Comment 6 E.Z. Hart [MSFT] 2017-10-05 20:58:58 UTC
(In reply to post4me3 from comment #5)
> @E.Z.Hart - Have sent you email with a repo project and video that shows the
> gestures used.

Haven't seen anything come through yet - which email address did you send it to?
Comment 7 post4me3 2017-10-05 21:02:07 UTC
I sent to this one :

	ez.hart@xamarin.com
Comment 8 E.Z. Hart [MSFT] 2017-10-05 22:38:37 UTC
(In reply to post4me3 from comment #7)
> I sent to this one :
> 
> 	ez.hart@xamarin.com

Just to be sure, can you also send it to ehart@microsoft.com?
Comment 9 E.Z. Hart [MSFT] 2017-10-09 16:19:28 UTC
Possible PR for this: https://github.com/xamarin/Xamarin.Forms/pull/1188
Comment 10 Rui Marinho 2017-10-16 14:32:54 UTC
Hi Philipp it should be fixed on 2.4.0 service release 2, we will need you to update and verify if this fixes the issue for you. 
If you still see the issue we will reopen and continue investigation.
Comment 11 Paul DiPietro [MSFT] 2017-10-16 19:10:31 UTC
*** Bug 60208 has been marked as a duplicate of this bug. ***
Comment 12 Ed Owens 2017-10-17 01:09:01 UTC
Sorry folks, but I've installed v2.4.0.282 of Xamarin Forms and v26.0.2 of Xamarin Android Support and I still get the same (non) response.  Taps continue to be ignored.  I agree that my bug is a duplicate of this one but let's get this fixed.
Comment 13 Philipp Sumi 2017-10-17 01:12:19 UTC
Ed, I think Rui is referring to a newer build that isn't out yet - the PR has only been merged a few hours ago. 2.4.0.282 is definitely broken.
Comment 14 Ed Owens 2017-10-17 03:33:26 UTC
BTW, I would be glad to test your service release 2, especially if Philipp can't or doesn't have the time.  I'm in Singapore right now, so can do over your night time.
Comment 15 Ed Owens 2017-10-20 02:21:43 UTC
What is the status on this bug?  It's reported as RESOLVED FIXED but is still live in the field.  When will the fix be released?
Comment 16 Justin 2017-10-20 20:21:09 UTC
I have pulled your latest .18342 update.  My other gestures seem to be fine now.  However I have tap gestures that are on carousel views which are themselves on scroll views.  So there is possible scrolling on the x and y axis.  It seems I can agree with the concept of a "micro swipe" as stated above.  It's almost like the threshold between what becomes a tap versus a swipe is too sensitive for the scroll side. You essentially have to tap it perfectly for it to fire as a tap.
Comment 17 Philipp Sumi 2017-10-20 21:06:56 UTC
That is really worrysome. Most of my controls are on carousel views - which often contain scrollviews as well. If somebody from Xamarin is still following this, can you maybe follow up?
Comment 18 David Ortinau [MSFT] 2017-10-20 21:24:36 UTC
We've been testing this aggressively and there is more work to be done for sure. I'm correcting the status.

In terms of getting no tap response, I have not been able to reproduce that situation. Please upload a small reproduction here so we can have something to test against.

In my tests I noted that taps were successful less than 100% of the time (15 our of 25 taps for example). I also noted if my tap was what Philipp calls a "micro swipe" it wouldn't register as a tap. 

My tests were on:
- Android 8.0
- Google Pixel
- API 25
Comment 19 Philipp Sumi 2017-10-20 21:31:05 UTC
Maybe we've been dealing with two bugs: Taps not being registered due to them being not being perfectly accurate, and then the double tap gesture issues that basically rendered subsequent taps useless. One down, one to go?
Comment 20 Justin 2017-10-20 22:03:31 UTC
I think the micro swipe that you are seeing is actually the same problem I am seeing on the content views.  I have the same problems with things that are stacked on a simple scroll view as well.

I simply recreate the issue by making a new app with a scroll view that has a box with a tap gesture recognizer on it.

New App -> New Page -> Box -> TGR


The box is made to change colors randomly with each tap.  If you simply "peck" the screen really fast and straight it will register every time.  If you lazily tap like most people normally do, any kind of slight swipe from a finger causes it to not register the tap.
Comment 21 Justin 2017-10-20 22:03:53 UTC
Carousel views** Sorry!!
Comment 22 Justin 2017-10-20 22:05:19 UTC
New App -> New Page -> Scroll View -> Box -> TGR**

Sorry! I need to pay more attention when I'm typing!! :-)
Comment 23 Philipp Sumi 2017-10-20 22:08:34 UTC
Bugzilla sort of reminds me of SourceSafe for source control. Both dinosaurs, only that one of them unfortunately isn't extinct ;)
Comment 24 Philipp Sumi 2017-10-20 22:09:19 UTC
...*yet*

(just making a point. scnr.)
Comment 25 Justin 2017-10-20 22:16:31 UTC
I don't mind Bugzilla, it may be old, but it's simple and does the job.  It could have edit features though...

But your assessment of it possibly being two issues is the same impression I have.  The  last fix has made the TGR noticeably better for me to think the other issue was resolved.  However this definitely still crops up.

It's almost like there's a threshold set between a tap and a swipe and it needs to go more towards the tap side. Like the tap is *too* perfect.
Comment 26 Ed Owens 2017-10-21 10:33:49 UTC
Just installed v2.4.0.18342 and am not getting the taps per discussion above.  The 'micro-swipe' may be the issue, these fingers are old and worn from coding for more years than they remember.  I did post a URL for a test case on Onedrive previously but here it is again.  It's as trimmed down as I can make it.

https://1drv.ms/u/s!Ak530OCobHh6gV-soeTbOk2EStYB
Comment 27 E.Z. Hart [MSFT] 2017-10-24 23:24:31 UTC
I've confirmed that there is very definitely a second bug here, and Philipp Sumi's description of the problem as "micro-swipes" is pretty much dead-on accurate. 

PR: https://github.com/xamarin/Xamarin.Forms/pull/1227
Comment 28 E.Z. Hart [MSFT] 2017-10-25 19:39:33 UTC
*** Bug 60341 has been marked as a duplicate of this bug. ***
Comment 29 Ed Owens 2017-10-27 01:04:00 UTC
Just a note.  Since my app doesn't rely on swipes I added a panGestureRegonizer and passed it's completed event to my tapGestureRecognizer and now all the 'taps' respond quickly.
Comment 30 Samantha Houts [MSFT] 2017-10-27 17:35:24 UTC
Should be fixed in 2.4.0 SR3. Thank you!
Comment 31 batmaci 2017-10-27 20:52:18 UTC
How about a fix for 2.5 Pre?  Can you please apply this fix for it also
Comment 32 Samantha Houts [MSFT] 2017-10-27 21:03:39 UTC
Yep, the fix will be included in all versions going forward. Thanks!
Comment 33 batmaci 2017-10-30 13:24:51 UTC
I can see that there is a release on github as https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.4.0-sr3

Is it not yet pushed to nuget? what is the ETA?
Comment 34 dhaligas 2017-10-30 15:35:04 UTC
yes when will see this live???
Comment 35 Luca Pappagallo 2017-10-31 11:48:49 UTC
The bug seems to be solved with https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.4.0-sr3
Thank you!
Comment 36 Justin 2017-10-31 20:55:17 UTC
It's awesome that these issues are being resolved so quickly. It looks like there's a release tagged on GitHub.  Is there a timeframe for when this will go live on Nuget?
Comment 37 Samantha Houts [MSFT] 2017-10-31 22:45:49 UTC
It went live on nuget yesterday. https://www.nuget.org/packages/Xamarin.Forms/2.4.0.38779
Comment 38 Justin 2017-10-31 23:32:21 UTC
Weird, VS didn't seem to pick it up until today.  However I can confirm this seems to have fixed my issue.