{ "id": "176195", "key": "TIMOB-28454", "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": "21199", "description": "", "name": "Release 10.0.1", "archived": false, "released": true, "releaseDate": "2021-07-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-05-24T14:51:13.000+0000", "created": "2021-05-18T21:23:13.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "click", "longpress", "touch" ], "versions": [], "issuelinks": [ { "id": "59265", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "176187", "key": "TIMOB-28446", "fields": { "summary": "Android: Issues with touch feedback / ripple effect", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-05-24T14:51:24.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nWhen tapping on a view with \"touchEnabled\" set to {{false}}, the parent will wrongly fire a \"longpress\" event if it has a listener set up on it. That is, it fires when you're not actually long pressing it and should be a click instead. This issue does not happen if \"touchEnabled\" is set to {{true}}.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below on Android.\r\n# Tap on the \"Click Me\" label.\r\n# Notice you get a dialog displaying \"click\". _(This is good.)_\r\n# Notice you also get a dialog displaying \"longpress\". _(This is the bug.)_\r\n\r\n{code:javascript}\r\nconst window = Ti.UI.createWindow({ backgroundColor: \"white\" });\r\nconst view = Ti.UI.createView({\r\n\tbackgroundColor: \"blue\",\r\n\ttouchFeedback: true,\r\n\twidth: \"250dp\",\r\n\theight: \"250dp\",\r\n});\r\nview.add(Ti.UI.createLabel({\r\n\ttext: \"Click Me\\nor\\nLong Press Me\",\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcolor: \"white\",\r\n\ttouchEnabled: false,\r\n}));\r\nview.addEventListener(\"click\", () => {\r\n\talert(\"click\");\r\n});\r\nview.addEventListener(\"longpress\", (e) => {\r\n\tconst formatter = new Intl.NumberFormat(Ti.Locale.currentLocale, {\r\n\t\tmaximumFractionDigits: 0,\r\n\t\tminimumFractionDigits: 0,\r\n\t});\r\n\talert(`longpress (${formatter.format(e.x)},${formatter.format(e.y)})`);\r\n});\r\nwindow.add(view);\r\nwindow.open();\r\n{code}\r\n\r\n*Cause:*\r\nWe're running into the same issue mentioned here...\r\nhttps://stackoverflow.com/questions/24326530/long-press-in-gesturedetector-also-fires-on-tap\r\n\r\nThe issue is that Google's {{GestureDetector}} sends a \"longpress\" message via a timeout which doesn't get canceled since the touch event isn't handled. The solution may be to implement our own custom long press event handling.\r\n\r\n*Note:*\r\nA \"longpress\" event should also cause the device to vibrate like how the native \"longclick\" works. This would match the behavior seen in Google's apps. The vibration should only happen if an event listener has been added for it.\r\n", "attachment": [], "flagged": false, "summary": "Android: \"longpress\" event wrongly fires when tapping a touch disabled view", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "458689", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12820", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-05-18T21:39:13.000+0000", "updated": "2021-05-18T21:39:13.000+0000" }, { "id": "458703", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master and 10_0_X for 10.0.1 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2021-05-24T14:51:24.000+0000", "updated": "2021-05-24T14:51:24.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }