{ "id": "175506", "key": "TIMOB-28111", "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": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-11-19T16:18:04.000+0000", "created": "2020-09-04T16:16:08.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "regression" ], "versions": [ { "id": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-19T16:18:04.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": "h5.Description\r\n\r\nWhen listening to a TabGroup's focus event it is firing unexpectedly, for example it will fire in the following scenarios:\r\n\r\n* When opening a new Window with the TabGroup\r\n* After closing an alert\r\n\r\nI'm guessing this is coming the changes in TIMOB-27711 so it's possible that this might be an expected change in behaviour.\r\n\r\nTo workaround this and restore the behaviour of 9.0.3 the {{previousTab}} property of the event can be checked, if it is null then it was fired by an action matching those in 9.0.3.\r\n\r\n\r\n{code}\r\nvar basewin = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n\tlayout : 'vertical'\r\n});\r\n\r\nvar baseWinBtn = Ti.UI.createButton({\r\n\ttitle : 'open Nav Root win with delay',\r\n\ttop : 60\r\n});\r\n\r\nfunction getNavRootWin(title) {\r\n\tvar win = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'white',\r\n\t\ttitle : title\r\n\t});\r\n\tvar navWin = Titanium.UI.createNavigationWindow({\r\n\t\twindow : win\r\n\t})\r\n\treturn navWin;\r\n}\r\n\r\nbaseWinBtn.addEventListener('click', function() {\r\n\tvar indWin = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'red'\r\n\t});\r\n\tindWin.open();\r\n\tsetTimeout(function() {\r\n\t\tindWin.close();\r\n\t\tvar navRootWn = getNavRootWin('Dynamic window');\r\n\t\ttab.open(navRootWn);\r\n\t}, 500);\r\n});\r\nbasewin.add(baseWinBtn);\r\nvar baseWinBtn1 = Ti.UI.createButton({\r\n\ttitle : 'open Nav Root win without delay',\r\n\ttop : 60\r\n});\r\nbaseWinBtn1.addEventListener('click', function() {\r\n\tvar indWin = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'red'\r\n\t});\r\n\tindWin.open();\r\n\tindWin.close();\r\n\tvar navRootWn = getNavRootWin('static window');\r\n\tvar openWin = Ti.UI.createButton({\r\n\t\ttitle : \"open dynamic win\"\r\n\t});\r\n\topenWin.addEventListener('click',function(){\r\n\tindWin.open();\r\n\tsetTimeout(function(){\r\n\t\tindWin.close();\r\n\tnavRootWn.openWindow(Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'white'\r\n\t}));\r\n\t},500);\r\n\t})\r\n\t\r\n\tnavRootWn.add(openWin);\r\n\ttab.open(navRootWn);\r\n});\r\nbasewin.add(baseWinBtn1);\r\nvar baseWinBtn2 = Ti.UI.createButton({\r\n\ttitle : 'open Nav Root win to check alertdialog',\r\n\ttop : 60\r\n});\r\nbaseWinBtn2.addEventListener('click', function() {\r\n\tvar navwin = getNavRootWin('Alert window');\r\n\tvar alertBtn = Ti.UI.createButton({\r\n\t\ttitle :'click to get alert'\r\n\t});\r\n\talertBtn.addEventListener('click',function(){\r\n\t\tTi.UI.createAlertDialog({\r\n\t\t\ttitle : \"test\",\r\n\t\t\tmessage : \"test msg\",\r\n\t\t\tbuttonNames : ['OK']\r\n\t\t}).show();\r\n\t});\r\n\tnavwin.add(alertBtn);\r\n\ttab.open(navwin);\r\n});\r\nbasewin.add(baseWinBtn2);\r\nvar tabGroup = Ti.UI.createTabGroup({\r\n\ttitle : '',\r\n\ttitleColor : \"#bbb\",\r\n\ttintColor : \"#bbb\",\r\n\tnavBarHidden : true\r\n});\r\nvar tab = Ti.UI.createTab({\r\n\ttitle : 'tab1',\r\n\twindow : basewin\r\n});\r\ntabGroup.addTab(tab);\r\nvar tab2 = Ti.UI.createTab({\r\n\ttitle : 'tab2',\r\n\twindow : Ti.UI.createWindow({backgroundColor : 'white'})\r\n});\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\ntabGroup.addEventListener('focus',function(e){\r\n // if (!e.previousTab) {\r\n // return;\r\n // }\r\n\tTi.API.info('in tabgroup focus');\r\n});\r\n{code}\r\n\r\nh5.Steps to reproduce\r\n\r\n1. Add the above code to an existing app.js and build to iOS\r\n2. Click on “open Nav Root win with delay” and check the logs (tabgroup focus event fired)\r\n3. Click on “open Nav Root win without delay” and check the logs (tabgroup focus event not fired)\r\n4. Click on “open Nav Root win to check alertdialog” and click on “click to get alert” button and click “OK” button of alert dialog and check the logs (tabgroup focus event fired)\r\n\r\nh5.Actual\r\n\r\nfocus event fires in steps 2,3, and 4.\r\n\r\nh5.Expected\r\n(9.0.3 behaviour)\r\n\r\nFocus event should only fire when selected the second tab", "attachment": [], "flagged": false, "summary": "iOS: TabGroup focus event firing unexpectedly", "creator": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "subtasks": [], "reporter": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "environment": null, "closedSprints": [ { "id": 1206, "state": "closed", "name": "2020 Sprint 19", "startDate": "2020-09-14T20:01:00.000Z", "endDate": "2020-09-25T20:01:00.000Z", "completeDate": "2020-09-28T15:30:19.875Z", "originBoardId": 114 }, { "id": 1207, "state": "closed", "name": "2020 Sprint 20", "startDate": "2020-09-28T15:30:47.481Z", "endDate": "2020-10-09T15:30:00.000Z", "completeDate": "2020-10-09T16:33:43.453Z", "originBoardId": 114 }, { "id": 1208, "state": "closed", "name": "2020 Sprint 21", "startDate": "2020-10-12T16:34:00.000Z", "endDate": "2020-10-23T16:34:00.000Z", "completeDate": "2020-10-23T02:32:43.674Z", "originBoardId": 114 }, { "id": 1209, "state": "closed", "name": "2020 Sprint 22", "startDate": "2020-10-27T02:33:00.000Z", "endDate": "2020-11-07T02:33:00.000Z", "completeDate": "2020-11-06T17:45:42.610Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "456743", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~vijaysingh] [~cwilliams] I'm not sure whether this is an expected behaviour change from TIMOB-27711 or not?", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-09-04T16:18:04.000+0000", "updated": "2020-09-04T16:18:04.000+0000" }, { "id": "456747", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~eharris], I'm a little confused what the bug actually is.\r\n\r\nThe iOS behavior is supposed to be this:\r\n* Window/TabGroup will fire a \"blur\" event after opening a child window/dialog.\r\n* Window/TabGroup will fire a \"focus\" event after closing a child window/dialog.\r\n\r\nI'm guessing this ticket's issue is only with NavigationWindow?", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-09-05T04:40:07.000+0000", "updated": "2020-09-05T04:40:07.000+0000" }, { "id": "456751", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~jquick] their event listener is only configured on TabGroup, but maybe the fact that it's a TabGroup with a NavigationWindow is causing issues?\r\n\r\nOn iOS in 9.0.3 the TabGroup focus event wouldn't fire in the circumstances it does now, and there's nothing listed in the release notes that really indicates we changed anything. \r\n\r\nItems 2 & 3 maybe make sense to have firing focus as ultimately a new Window is being opened in the Tab (albeit the code is a little convoluted). This might be an expected behaviour change from TIMOB-27711.\r\n\r\nItem 4 is a little more suspect to me, when the alert is dismissed the TabGroup focus event is fired. This doesn't occur on Android based on the code below (the code in the description errors out on Android).\r\n\r\n{code}\r\nvar basewin = Ti.UI.createWindow({\r\n\tlayout : 'vertical'\r\n});\r\n\r\nvar baseWinBtn2 = Ti.UI.createButton({\r\n\ttitle : 'open win to check alertdialog',\r\n\ttop : 60\r\n});\r\nbasewin.add(baseWinBtn2);\r\n\r\nvar tabGroup = Ti.UI.createTabGroup();\r\nvar tab = Ti.UI.createTab({\r\n\ttitle : 'tab1',\r\n\twindow : basewin\r\n});\r\n\r\nbaseWinBtn2.addEventListener('click', function() {\r\n\tvar win = Ti.UI.createWindow({\r\n\t\ttitle : 'Alert window'\r\n\t});\r\n\tvar alertBtn = Ti.UI.createButton({\r\n\t\ttitle :'click to get alert'\r\n\t});\r\n\talertBtn.addEventListener('click',function(){\r\n\t\talert('test');\r\n\t});\r\n\twin.add(alertBtn);\r\n\ttab.open(win);\r\n});\r\n\r\ntabGroup.addTab(tab);\r\ntabGroup.open();\r\ntabGroup.addEventListener('focus',function(e) {\r\n\tTi.API.info('in tabgroup focus');\r\n});\r\n{code}", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-09-07T10:04:46.000+0000", "updated": "2020-09-07T10:04:46.000+0000" }, { "id": "456776", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I see. I suspect this has to do with the [Tab.open()|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Tab-method-open] method. On iOS, this will open a child window within the {{TabGroup}}. Meaning the {{TabGroup}} still has the focus because it is still onscreen, hosting the child window. This probably has nothing to do with the {{NavigationWindow}}.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-09-08T19:54:26.000+0000", "updated": "2020-09-08T19:54:44.000+0000" }, { "id": "457320", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-23T00:16:44.000+0000", "updated": "2020-10-23T00:19:50.000+0000" }, { "id": "457321", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR - https://github.com/appcelerator/titanium_mobile/pull/12207\r\n\r\nTest Case - \r\n{code:java}\r\nvar basewin = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n\tlayout : 'vertical'\r\n});\r\n \r\nvar baseWinBtn = Ti.UI.createButton({\r\n\ttitle : 'Push next window (tab.open(win))',\r\n\ttop : 60\r\n});\r\nbasewin.add(baseWinBtn); \r\n\r\n\r\nvar baseWinBtn2 = Ti.UI.createButton({\r\n\ttitle : 'Open another window (win.open())',\r\n\ttop : 120\r\n});\r\nbasewin.add(baseWinBtn2); \r\n\r\nvar baseWinBtn3 = Ti.UI.createButton({\r\n\ttitle : 'Show Alert',\r\n\ttop : 180\r\n});\r\nbasewin.add(baseWinBtn3); \r\n\r\nbaseWinBtn.addEventListener('click', function() {\r\n\tvar indWin = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'red'\r\n\t});\r\n\r\n\ttab.open(indWin);\r\n\r\n\tvar alertBtn = Ti.UI.createButton({\r\n\t\ttop: 60,\r\n\t\ttitle :'click to get alert'\r\n\t});\r\n\talertBtn.addEventListener('click',function(){\r\n\t\tTi.UI.createAlertDialog({\r\n\t\t\ttitle : \"test\",\r\n\t\t\tmessage : \"test msg\",\r\n\t\t\tbuttonNames : ['OK']\r\n\t\t}).show();\r\n\t});\r\n\tindWin.add(alertBtn);\r\n\r\n\tvar closeBtn = Ti.UI.createButton({\r\n\t\ttop: 120,\r\n\t\ttitle :'Close Window'\r\n\t});\r\n\tcloseBtn.addEventListener('click',function(){\r\n\t\ttab.close(indWin);\r\n\t});\r\n\tindWin.add(closeBtn);\r\n\r\n});\r\n\r\n\r\nbaseWinBtn2.addEventListener('click', function() {\r\n\tvar indWin = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'red'\r\n\t});\r\n\r\n\tindWin.open(); //{modal: true, animation: true}\r\n\r\n\tvar closeBtn = Ti.UI.createButton({\r\n\t\ttitle :'Close button'\r\n\t});\r\n\tcloseBtn.addEventListener('click',function(){\r\n\t\tindWin.close();\r\n\t});\r\n\tindWin.add(closeBtn);\r\n});\r\n\r\nbaseWinBtn3.addEventListener('click', function() {\r\n\tTi.UI.createAlertDialog({\r\n\t\ttitle : \"test\",\r\n\t\tmessage : \"test msg\",\r\n\t\tbuttonNames : ['OK']\r\n\t}).show();\r\n});\r\n\r\nvar tabGroup = Ti.UI.createTabGroup({\r\n\ttitle : '',\r\n\ttitleColor : \"#bbb\",\r\n\ttintColor : \"#bbb\",\r\n\tnavBarHidden : true\r\n});\r\nvar tab = Ti.UI.createTab({\r\n\ttitle : 'tab1',\r\n\twindow : basewin\r\n});\r\ntabGroup.addTab(tab);\r\nvar tab2 = Ti.UI.createTab({\r\n\ttitle : 'tab2',\r\n\twindow : Ti.UI.createWindow({backgroundColor : 'white'})\r\n});\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\ntabGroup.addEventListener('focus',function(e){\r\n\tTi.API.info('in tabgroup focus');\r\n});\r\n\r\ntabGroup.addEventListener('blur',function(e){\r\n\tTi.API.info('in tabgroup blur');\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-23T01:01:29.000+0000", "updated": "2020-10-23T01:01:29.000+0000" }, { "id": "457464", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR passed, waiting on Jenkins build ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-05T16:01:31.000+0000", "updated": "2020-11-05T16:01:31.000+0000" }, { "id": "457465", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master for 9.3.0 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-11-05T17:33:07.000+0000", "updated": "2020-11-05T17:33:07.000+0000" }, { "id": "457646", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Fix verified in SDK version {{9.3.0.v20201119063936}}.\r\n\r\nTest and other information can be found at:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/12207", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-19T16:17:55.000+0000", "updated": "2020-11-19T16:17:55.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }