{ "id": "169245", "key": "TIMOB-25061", "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": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-08-08T21:34:17.000+0000", "created": "2017-08-02T15:11:24.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android" ], "versions": [ { "id": "19572", "description": "Important fixes for 6.1.0", "name": "Release 6.1.1", "archived": false, "released": true, "releaseDate": "2017-06-16" }, { "id": "19870", "description": "", "name": "Release 6.1.2", "archived": false, "released": true, "releaseDate": "2017-08-03" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-08-08T21:34:17.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h5. Issue description\r\nUsing the setSelection method on a textField causes a _*change*_ event to be fired (when the value has not been updated).\r\n\r\nh5. Steps to reproduce\r\nTo reproduce this issue with a textField variable, the following code snippet should work and show the issue in action, once the user focuses on a given field:\r\n\r\n{code:javascript}\r\n// within method setting up textField event listeners\r\n\r\ntextFieldVar.addEventListener(\"focus\", $.handleTextFieldEvent);\r\n\r\n// elsewhere\r\n\r\n$.handleTextFieldEvent = function(e) {\r\n Ti.API.info(e.type + \" event fired\");\r\n if(e.type === \"focus\"){\r\n Ti.API.info(\"set selection of text\");\r\n e.source.setSelection(0, 1);\r\n }\r\n};\r\n{code}\r\n\r\nThis should lead to output like:\r\n\r\n{code:bash}\r\n[INFO] focus event fired\r\n[INFO] set selection of text\r\n[INFO] change event fired\r\n{code}\r\n\r\nWithin a code flow that uses an auto-advancing form (based on single values within textField elements with change events that trigger a move onto the _next_ textField element), this effectively causes the form to be cycled through, and prevents user input.", "attachment": [], "flagged": false, "summary": "Android: setSelection method on textField fires change event, and value is not changing", "creator": { "name": "plancaster", "key": "plancaster", "displayName": "Peter Lancaster", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "plancaster", "key": "plancaster", "displayName": "Peter Lancaster", "active": true, "timeZone": "Europe/London" }, "environment": "Ti SDK 6.1.1.GA / 6.1.2.v20170727160839\r\nAppcelerator CLI 6.2.2\r\nNode 4.6.2\r\nAndroid SDK Platform-tools 23.3", "closedSprints": [ { "id": 933, "state": "closed", "name": "2017 Sprint 16 SDK", "startDate": "2017-07-30T16:17:10.306Z", "endDate": "2017-08-13T16:17:00.000Z", "completeDate": "2017-08-13T23:06:34.398Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "425905", "author": { "name": "plancaster", "key": "plancaster", "displayName": "Peter Lancaster", "active": true, "timeZone": "Europe/London" }, "body": "Hi guys - is there any update on this? The only workaround we currently have for this would sacrifice usability and functionality, which is highly undesirable.", "updateAuthor": { "name": "plancaster", "key": "plancaster", "displayName": "Peter Lancaster", "active": true, "timeZone": "Europe/London" }, "created": "2017-08-04T09:47:00.000+0000", "updated": "2017-08-04T09:47:00.000+0000" }, { "id": "425974", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello [~plancaster] \r\nWe have looked at this today and were able to reproduce. The change that triggers this behavior was a workaround for a google bug and was implemented 1 year ago. See https://stackoverflow.com/questions/22933803/edittexts-selectall-does-not-select-the-text-instead-cursor-is-moved-to-posi/35527348#35527348 for the description of the issue and https://github.com/appcelerator/titanium_mobile/blame/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java#L683 for the section of the SDK where it was implemented. Basically it does a replace, which would fire the change event. At this point I don't have a good workaround for you, but as soon as I have a fix we can get you a build to try. 6.2.0 is our next build, scheduled for the end of this month. I will work with support to see what other options are available and will get you that info through them. I will update this ticket should we find a workaround in the meantime. Expect an update early next week.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-04T21:51:35.000+0000", "updated": "2017-08-04T21:51:35.000+0000" }, { "id": "425975", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the issue is reproducible.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'grey',\r\n layout: 'vertical'\r\n});\r\n\r\nvar txtfld = Ti.UI.createTextField({\r\n\ttop: 30,\r\n\twidth: 50,\r\n\tvalue: 'Hello'\r\n});\r\n\r\ntxtfld.addEventListener('focus', function(e) {\r\n\tTi.API.info(e.type + \" event fired txtfld\");\r\n\tif(e.type === \"focus\"){\r\n\t Ti.API.info(\"set selection of text txtfld\");\r\n\t e.source.setSelection(0, 1);\r\n\t}\r\n});\r\n\r\ntxtfld.addEventListener('change', function(){\r\n\tTi.API.info('=========================================');\r\n\tTi.API.info('Change Fired on txtfld');\r\n});\r\n\r\nwin.add(txtfld);\r\nwin.open();\r\n{code}\r\n\r\nResult:\r\n{code}\r\n[INFO] : focus event fired txtfld\r\n[INFO] : set selection of text txtfld\r\n[INFO] : =========================================\r\n[INFO] : Change Fired on txtfld\r\n{code}\r\n\r\nStudio Ver: 4.9.1.201707200100\r\nSDK Ver: 6.1.2.GA\r\nOS Ver: 10.12.3\r\nXcode Ver: Xcode 8.3.3\r\nAppc NPM: 4.2.9\r\nAppc CLI: 6.2.3\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.9.13\r\nNode Ver: 6.10.1\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ google Nexus 5 --- Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-04T21:56:13.000+0000", "updated": "2017-08-04T21:56:51.000+0000" }, { "id": "426147", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/9281\r\nPR (6.2.X): https://github.com/appcelerator/titanium_mobile/pull/9282\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-08T01:39:40.000+0000", "updated": "2017-08-08T01:39:40.000+0000" }, { "id": "426284", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed for both branches.\r\nPR merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-08T21:34:17.000+0000", "updated": "2017-08-08T21:34:17.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }