{ "id": "173888", "key": "TIMOB-27249", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "20845", "name": "Release 8.1.1", "archived": false, "released": true, "releaseDate": "2019-08-29" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-08-21T13:58:10.000+0000", "created": "2019-07-17T03:29:58.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "OptionDialog", "android", "dialog", "index" ], "versions": [], "issuelinks": [], "assignee": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "updated": "2019-08-21T13:58:11.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\nAs of Titanium 8.1.0, Android now supports displaying an {{OptionDialog}} without radio buttons if its \"selectedIndex\" property is not set (or set to {{-1}}). See: [TIMOB-26793]\r\n\r\nBut one usability issue with the current implementation is that tapping on an {{OptionDialog}} button causes the \"selectedIndex\" to be set to the index of the tapped button. The issue with this is if the {{OptionDialog}} is re-shown, it'll show radio buttons instead of plain buttons which is not desired. This happens because the \"selectedIndex\" was set.\r\n\r\n*Proposed Solution:*\r\nIf the {{OptionDialog}} is not showing radio buttons, then it should not automatically set the \"selectedIndex\" property when tapping a button. The \"click\" event already provides the index of the button that was tapped on and this is enough. Besides, iOS does not support the \"selectedIndex\" property anyways, making this behavior portable.\r\n\r\nHowever, if the developer does set \"selectedIndex\" via code to show radio buttons, then the {{OptionDialog}} should maintain the old behavior and update the \"selectedIndex\" property with the clicked button index.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below code on Android.\r\n# Tap on the \"Show Dialog\" button.\r\n# Tap on the dialog's \"Option 1\" button.\r\n# Tap on the \"Show Dialog\" button again to re-show it.\r\n# Notice the dialog shows radio buttons in front of every option button. _(This is the usability issue.)_\r\n\r\n{code:javascript}\r\nvar dialog = Ti.UI.createOptionDialog({\r\n\ttitle: \"Option Dialog\",\r\n\toptions: [\"Option 1\", \"Option 2\", \"Cancel\"],\r\n\tcancel: 2,\r\n});\r\ndialog.addEventListener(\"click\", function(e) {\r\n\tTi.API.info(\"@@@ Dialog 'click' index: \" + e.index + \", button: \" + e.button + \", cancel: \" + e.cancel);\r\n});\r\ndialog.addEventListener(\"cancel\", function(e) {\r\n\tTi.API.info(\"@@@ Dialog 'cancel'\");\r\n});\r\n\r\nvar window = Ti.UI.createWindow();\r\nvar button = Ti.UI.createButton({ title: \"Show Dialog\" });\r\nbutton.addEventListener(\"click\", function(e) {\r\n\tdialog.show();\r\n});\r\nwindow.add(button);\r\nwindow.open();\r\n{code}\r\n\r\n*Work-around:*\r\nSet \"selectedIndex\" to {{-1}} before re-showing the dialog.\r\n{code:javascript}\r\ndialog.selectedIndex = -1;\r\ndialog.show();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: OptionDialog without radio buttons should not auto-set \"selectedIndex\" property after clicking option", "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": 1160, "state": "closed", "name": "2019 Sprint 17", "startDate": "2019-08-12T07:59:28.950Z", "endDate": "2019-08-25T07:59:00.000Z", "completeDate": "2019-08-26T15:35:29.980Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "449856", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FYI: [~michael]\r\n\r\nKeeping you in the loop since you've implemented this feature. Doing this via \"selectedIndex\" set to {{null}}/{{-1}} was my idea and it was my mistake for not noticing the usability issue to begin with.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-07-17T03:37:37.000+0000", "updated": "2019-07-17T03:37:37.000+0000" }, { "id": "449879", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jquick] Thanks for the info. Are you going to have a look at a fix or shall I give it a go?", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-07-17T18:41:48.000+0000", "updated": "2019-07-17T18:41:48.000+0000" }, { "id": "449880", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We're thinking about making this change for 8.1.0.GA.\r\n\r\nIf you're willing to make this change this week, then please feel free to do so. Otherwise I'll get someone on our end to do it. Thanks.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-07-17T18:43:31.000+0000", "updated": "2019-07-17T18:43:31.000+0000" }, { "id": "449912", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/11059", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2019-07-18T16:22:11.000+0000", "updated": "2019-07-18T16:22:11.000+0000" }, { "id": "450107", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. waiting for 8.1.0 GA to merge this PR. Also back port PR is needed .", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-07-26T22:06:07.000+0000", "updated": "2019-07-26T22:06:07.000+0000" }, { "id": "450624", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Merged to master; cherry-picked to 8_3_X and 8_1_X", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-08-20T17:03:09.000+0000", "updated": "2019-08-20T17:03:09.000+0000" }, { "id": "450669", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket* fix verified in SDK version {{8.2.0.v20190820104021}}, {{8.1.1.v20190820143437}} and {{8.3.0.v20190820103430}}.\r\n\r\nTest and other information can be found at:\r\nPR (master): https://github.com/appcelerator/titanium_mobile/pull/11059\r\n\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-08-21T13:58:04.000+0000", "updated": "2019-08-21T13:58:04.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }