Bug 50201 - The touch up inside event is firing when the touch lift is outside a UIButton
Summary: The touch up inside event is firing when the touch lift is outside a UIButton
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-12-15 22:37 UTC by Gary
Modified: 2017-01-05 13:36 UTC (History)
4 users (show)

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

Test XS project shown in the video (13.68 KB, application/zip)
2016-12-15 22:37 UTC, Gary
Screenshot of the Xcode mapping (129.93 KB, image/png)
2016-12-15 22:43 UTC, Gary
Screenshot of the event handler implementation (54.79 KB, image/png)
2016-12-15 22:44 UTC, Gary
Video recording of the test (133.45 KB, video/mp4)
2016-12-15 22:45 UTC, Gary

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:

Description Gary 2016-12-15 22:37:55 UTC
Created attachment 18900 [details]
Test XS project shown in the video

Clicking a UIButton or descendant class fires the touch up inside event when the touch up is actually outside the button.  Please see the attached test project, screen shots, and video.
Comment 1 Gary 2016-12-15 22:43:19 UTC
Created attachment 18901 [details]
Screenshot of the Xcode mapping
Comment 2 Gary 2016-12-15 22:44:17 UTC
Created attachment 18902 [details]
Screenshot of the event handler implementation
Comment 3 Gary 2016-12-15 22:45:06 UTC
Created attachment 18903 [details]
Video recording of the test
Comment 4 Gary 2016-12-15 23:01:12 UTC
Upon further testing, I am able to get the Outside label to appear but the touch has to be lifted very far away from the button.  So maybe this is expected behavior and this issue can be closed.
Comment 5 Gary 2017-01-02 17:24:30 UTC


there is this sentence:

The TouchUpInside event occurs when the user performs a touch operation that begins and ends inside the bounds of the button.

I am interested in learning why this issue has been marked as invalid, with no supporting screen shot, URL, or sentence of explanation.
Comment 6 Manuel de la Peña [MSFT] 2017-01-05 11:56:51 UTC

The bug has been marked as invalid due to the following:

The behaviour your are experiencing is the expected one with a UIButton, it cannot be changed by us (xamarin engineers). In your screencast, the mouse is no leaving the tappable area of the UIButton and ergo, even if visually it does look that you are outside, you are not. This is of course due to the fact that we are working with a touch UI.

Repeating the test and making sure that you leave the tappable area will have the expected result. If you want to reduce the hit area of the button you will need to extend the UIButton and override:

public virtual Boolean PointInside (PointF point, UIEvent uievent)

So that it works as you expect it. As you mentioned in comment 4, yes, the event gets called if you leave the tap area, ergo, the bug is invalid and you did discover the issue by yourself and that is the reason the bug was closed with no comment.
Comment 7 Manuel de la Peña [MSFT] 2017-01-05 13:18:36 UTC
Sorry if there was a misunderstanding when closing the bug, definitely a comment explaining the reason for the invalidation of the bug was needed, sorry for that.
Comment 8 Vincent Dondain [MSFT] 2017-01-05 13:36:21 UTC

I would like to add this quick Objective C sample to show that the same behavior would happen with native code: https://www.dropbox.com/s/w39uhfnibs0bepb/Bug50201.zip?dl=0

Also I added the "TouchDragOutside" event so you can see in the logs (debug area) when exactly the "outside" touch zone is reached.

This is all a bit confusing and I couldn't find any good documentation about this native iOS behavior.

The doc you found (from us, same as Apple): "The TouchUpInside event occurs when the user performs a touch operation that begins and ends inside the bounds of the button." is confusing because the "bounds" of the UIButton are similar to what's drawn, so 150x50 in your case, and the "touch area" is also contained within this draw area.

What I believe happens (and again since that's internal behavior these are just assumptions, helped by community posts) is that since it's a touch UI (like Manuel said) iOS creates like an "extended safe zone" to be 100% sure all humans (we don't all have the same fingers) indeed exit the touch area of the button.