{ "id": "171864", "key": "TIMOB-26172", "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": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-07-03T12:07:43.000+0000", "created": "2018-06-30T02:49:09.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "blur", "bubble", "focus", "parity" ], "versions": [], "issuelinks": [ { "id": "56663", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "171873", "key": "TIMOB-26177", "fields": { "summary": "Windows: \"focus\" and \"blur\" events bubbles to parent views when it shouldn't", "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": "Medium", "id": "3" }, "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": "2018-07-03T21:57:06.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\nA view's {{focus}} and {{blur}} events are not supposed to bubble up to the view's parents according to our documentation here...\r\nhttps://docs.appcelerator.com/platform/latest/#!/guide/Event_Handling-section-src-29004896_EventHandling-Bubblingandnon-bubblingevents\r\n\r\nOn Android, they do bubble up. This can cause confusion since these events will bubble up to the window which use the {{focus}} and {{blur}} events to indicate if the window is active, not if it has gained/received input focus.\r\n\r\nThis is not an issue on iOS.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below code on Android.\r\n# If the TextField has the focus, then tap on the \"Remove Focus\" button.\r\n# Clear the Android log.\r\n# Tap on the \"Set Focus\" button.\r\n# In the log, notice that the TextField focus event's \"bubbles\" property is set true. This is wrong.\r\n# In the log, notice the Window received a focus event after the TextField did. This is wrong.\r\n# Tap on the \"Remove Focus\" button.\r\n# In the log, notice that the TextField blur event's \"bubbles\" property is set true. This is wrong.\r\n# In the log, notice the Window received a blur event after the TextField did. This is wrong.\r\n\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow({\r\n\tlayout: \"vertical\",\r\n\tfullscreen: true,\r\n});\r\nvar textField = Ti.UI.createTextField({\r\n\tvalue: \"Focus Test\",\r\n\twidth: Ti.UI.FILL,\r\n\theight: Ti.UI.SIZE,\r\n});\r\ntextField.addEventListener(\"focus\", function(e) {\r\n\tTi.API.info(\"@@@ TextField 'focus' event received. bubbles: \" + e.bubbles);\r\n});\r\ntextField.addEventListener(\"blur\", function(e) {\r\n\tTi.API.info(\"@@@ TextField 'blur' event received. bubbles: \" + e.bubbles);\r\n});\r\nwindow.add(textField);\r\nvar focusButton = Ti.UI.createButton({ title: \"Set Focus\" });\r\nfocusButton.addEventListener(\"click\", function(e) {\r\n\ttextField.focus();\r\n});\r\nwindow.add(focusButton);\r\nvar blurButton = Ti.UI.createButton({ title: \"Remove Focus\" });\r\nblurButton.addEventListener(\"click\", function(e) {\r\n\ttextField.blur();\r\n});\r\nwindow.add(blurButton);\r\nwindow.addEventListener(\"focus\", function(e) {\r\n\tTi.API.info(\"@@@ Window 'focus' event received.\");\r\n});\r\nwindow.addEventListener(\"blur\", function(e) {\r\n\tTi.API.info(\"@@@ Window 'blur' event received.\");\r\n});\r\nwindow.open();\r\n{code}\r\n\r\n*Expected Result:*\r\nThe {{focus}} and {{blur}} events should not not bubble. Their {{bubbles}} property should be {{false}} and the parent window should not have received the TextField's events.\r\n\r\n*Work-Around:*\r\nSet the {{focus}} and {{blur}} event's {{cancelBubble}} property to {{true}} to prevent the event from propagating up the view hierarchy.\r\n{code:javascript}\r\nvar textField = Ti.UI.createTextField();\r\ntextField.addEventListener(\"focus\", function(e) {\r\n\te.cancelBubble = true;\r\n});\r\ntextField.addEventListener(\"blur\", function(e) {\r\n\te.cancelBubble = true;\r\n});\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: \"focus\" and \"blur\" events bubbles to parent views when it shouldn't", "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, "closedSprints": [ { "id": 1045, "state": "closed", "name": "2018 Sprint 13 SDK", "startDate": "2018-06-17T20:47:13.621Z", "endDate": "2018-07-01T20:47:00.000Z", "completeDate": "2018-07-02T18:40:05.029Z", "originBoardId": 114 }, { "id": 1050, "state": "closed", "name": "2018 Sprint 14 SDK", "startDate": "2018-07-01T18:40:57.193Z", "endDate": "2018-07-15T18:40:00.000Z", "completeDate": "2018-07-16T03:27:08.720Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "438880", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10145", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-30T03:28:11.000+0000", "updated": "2018-06-30T03:28:11.000+0000" }, { "id": "438945", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (7.3.x): https://github.com/appcelerator/titanium_mobile/pull/10149", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-02T22:17:30.000+0000", "updated": "2018-07-02T22:17:30.000+0000" }, { "id": "438952", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I'm suspecting this would happens on Windows too. I'll clone this ticket after checking on Windows.", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-07-02T23:24:44.000+0000", "updated": "2018-07-02T23:24:44.000+0000" }, { "id": "438993", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix in SDK 7.3.0.v20180703051211.\r\nClosing.\r\n\r\nStudio Ver: 5.1.0.201806291005\r\nSDK Ver: 7.3.0.v20180703051211\r\nOS Ver: 4.2.13\r\nXcode Ver: 7.0.4\r\nAppc NPM: 1.1.3\r\nAppc CLI: 10.13.5\r\nDaemon Ver: Xcode 9.4.1\r\nTi CLI Ver: 5.1.1\r\nAlloy Ver: 1.12.0\r\nNode Ver: 8.9.1\r\nNPM Ver: 5.5.1\r\nJava Ver: 10.0.1\r\nDevices: ⇨ google Nexus 5 --- Android 6.0.1\r\n ⇨ google Nexus 6P --- Android 8.1.0\r\nEmulator: ⇨ Android 4.1.2\r\n ", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-03T21:57:01.000+0000", "updated": "2018-07-03T21:57:01.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }