{ "id": "103158", "key": "TIMOB-11866", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "14161", "description": "Release 3.0.1", "name": "Release 3.0.1", "archived": true, "released": true, "releaseDate": "2013-02-19" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14700", "description": "2012 Sprint 25", "name": "2012 Sprint 25", "archived": true, "released": true, "releaseDate": "2012-12-17" }, { "id": "14784", "description": "2012 Sprint 25 API", "name": "2012 Sprint 25 API", "archived": true, "released": true, "releaseDate": "2012-12-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-12-06T01:25:08.000+0000", "created": "2012-10-11T20:42:15.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "module_views", "qe-testadded", "triage" ], "versions": [ { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" }, { "id": "14137", "description": "Release 2.1.3", "name": "Release 2.1.3", "archived": true, "released": true, "releaseDate": "2012-10-03" }, { "id": "14613", "description": "Release 2.1.4", "name": "Release 2.1.4", "archived": true, "released": true, "releaseDate": "2012-11-12" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "23650", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "98499", "key": "TIMOB-10322", "fields": { "summary": "iOS: click event on a view is on touch down, should be on touch up", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2013-01-15T15:36:00.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Actual result*\r\nUIView 'click' event is fired instantly when the user puts their finger inside the UIView.\r\n\r\n*Expected result*\r\nThe event should only be fired when click is completed.\r\n\r\nExamples:\r\n\r\n*ImageView*\r\n{code}\r\nvar window = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nvar image = Ti.UI.createImageView({\r\n\timage : \"KS_nav_ui.png\"\r\n});\r\n\r\nimage.addEventListener(\"click\", function() {\r\n\talert(\"I didn't removed my finger from touch yet!\");\r\n});\r\n\r\nwindow.add(image);\r\nwindow.open();\r\n{code}\r\n\r\n*View*\r\n{code}\r\nvar window = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nvar view = Ti.UI.createView({\r\n\twidth : 100,\r\n\theight : 100,\r\n\tbackgroundColor : \"#FF0000\"\r\n});\r\n\r\nview.addEventListener(\"click\", function() {\r\n\talert(\"It happens here too.\")\r\n});\r\n\r\nwindow.add(view);\r\nwindow.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Click event in UIView is firing immediately", "creator": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "subtasks": [], "reporter": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "environment": "iOS", "comment": { "comments": [ { "id": "223177", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Needs more info - what Titanium Mobile SDK? What iOS version?", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-11T21:29:57.000+0000", "updated": "2012-10-11T21:29:57.000+0000" }, { "id": "223193", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Hello Daniel,\n\nI think it happens since first SDK. But I'm using SDK 2.1.3.GA and iOS 6.\n\nThanks!", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-10-11T22:10:16.000+0000", "updated": "2012-10-11T22:10:16.000+0000" }, { "id": "223201", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is it possible to provide a copy + paste reproduction case that doesn't involve an image view? Or does it only happen with image views?", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-11T22:44:09.000+0000", "updated": "2012-10-11T22:44:09.000+0000" }, { "id": "223202", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "I think the problem is in all components based in UIView. For example:\n\n{code}\nvar view = Ti.UI.createView({\n\twidth: 100,\n\theight: 100,\n\tbackgroundColor: \"#FF0000\"\n});\nself.add(view);\n\nview.addEventListener(\"click\", function() {\n\talert(\"It happens here too.\")\n});\n{code}\n\nProbably the event *click* is inherited from UIView delegate, so, it happens to all components based in UIView.\n\nThanks", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-10-11T22:50:03.000+0000", "updated": "2012-10-11T22:50:03.000+0000" }, { "id": "223206", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Here is the code that produces it:\n\n**TiUIView.m** LINE: 1033 - Titanium SDK 2.1.3.GA\n{code}\n- (void)processTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event\n{\n UITouch *touch = [touches anyObject];\n\t\n\tif (handlesTouches)\n\t{\n\t\tNSMutableDictionary *evt = [NSMutableDictionary dictionaryWithDictionary:[TiUtils pointToDictionary:[touch locationInView:self]]];\n\t\t[evt setValue:[TiUtils pointToDictionary:[touch locationInView:nil]] forKey:@\"globalPoint\"];\n\t\t\n\t\tif ([proxy _hasListeners:@\"touchstart\"])\n\t\t{\n\t\t\t[proxy fireEvent:@\"touchstart\" withObject:evt propagate:YES];\n\t\t\t[self handleControlEvents:UIControlEventTouchDown];\n\t\t}\n // Click handling is special; don't propagate if we have a delegate,\n // but DO invoke the touch delegate.\n\t\t// clicks should also be handled by any control the view is embedded in.\n\t\tif ([touch tapCount] == 1 && [proxy _hasListeners:@\"click\"])\n\t\t{\n\t\t\tif (touchDelegate == nil) {\n\t\t\t\t[proxy fireEvent:@\"click\" withObject:evt propagate:YES];\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\t[touchDelegate touchesBegan:touches withEvent:event];\n\t\t\t}\n\t\t} else if ([touch tapCount] == 2 && [proxy _hasListeners:@\"dblclick\"]) {\n\t\t\t[proxy fireEvent:@\"dblclick\" withObject:evt propagate:YES];\n\t\t\treturn;\n\t\t}\n\t}\n}\n{code}\n\nYou can see, that *processTouchesBegan* is firing *click* event. ", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-10-11T23:05:07.000+0000", "updated": "2012-10-11T23:05:07.000+0000" }, { "id": "224680", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Is there any update? I really think that it needs to be resolved in 3.0 SDK.", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-10-23T00:44:40.000+0000", "updated": "2012-10-23T00:44:40.000+0000" }, { "id": "228668", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested and confirmed iOS 5.1, TISDK 2.1.2 GA, 2.1.3 GA, 2.1.4 GA, 3.0.0 CI.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-27T18:47:19.000+0000", "updated": "2012-11-27T18:47:19.000+0000" }, { "id": "229934", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending https://github.com/appcelerator/titanium_mobile/pull/3524", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-12-04T21:17:30.000+0000", "updated": "2012-12-04T21:17:30.000+0000" }, { "id": "232570", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Backport PR to 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3637", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-12-27T17:37:05.000+0000", "updated": "2012-12-27T17:37:05.000+0000" }, { "id": "233213", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with following\r\nTitanium SDK: 3.1.0.v20130102102603\r\nTitanium SDK:3.0.1.v20121228113204\r\nTitanium Studio:3.0.1.201212181159\r\nDevice: Simulator iOS 6.0", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-04T03:28:30.000+0000", "updated": "2013-01-04T03:28:30.000+0000" }, { "id": "234338", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "As of SDK 3.1.0.20130109175536, there's a side effect of this fix: if a slow click is performed (where the click lasts longer than half a second), the click event doesn't fire at all. I'm doing this with the mouse in the simulator, so there is no movement during the click. Is this intentional?", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2013-01-15T06:31:46.000+0000", "updated": "2013-01-15T06:31:46.000+0000" }, { "id": "234384", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Shawn Lipscomb - I believe that is a intended behavior change. If you click for more than half a second then it no longer is a click event , it becomes a long press instead.\n", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-15T10:28:42.000+0000", "updated": "2013-01-15T10:28:42.000+0000" }, { "id": "234479", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "I agree with Sabil. If you wanna handle a long press, you should use the longpress event.\r\n\r\nBTW, we could verify if UIView have some listener for *longpress*. If not have, we can fire event to click handler. What do you think? It probably will reduce some bugs in currently applications (and future).", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-01-15T15:36:00.000+0000", "updated": "2013-01-15T15:36:00.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }