{ "id": "93670", "key": "TIMOB-9718", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-06-21T23:13:59.000+0000", "created": "2012-06-21T22:48:52.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "updated": "2014-06-19T12:44:39.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": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "h3. Problem description\r\nSetting event listeners (tested using 'blur', 'focus' and 'change') to a textField results in getting bad behaviors, depending on the browser (tested on Firefox and Safari)\r\n\r\nh3. Steps to reproduce\r\n\r\nRun sample code and click on the textField.\r\nResult:\r\nFirefox: blur and focus events are triggered, then textField it's not focused.\r\nSafari: blur and focus events are triggered continuously (then have to actually kill the browser in this case)\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor:'#000'\r\n });\r\n \r\nvar inputTextField = Titanium.UI.createTextField({\r\n color : '#ff7c00',\r\n top:10,\r\n height : 50,\r\n width : '25%',\r\n left : '10%',\r\n borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,\r\n keyboardType : Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,\r\n returnKeyType : Titanium.UI.RETURNKEY_DONE,\r\n font : {\r\n fontSize : 20,\r\n fontColor : '#ff7c00',\r\n fontWeight : 'bold',\r\n fontFamily : 'Helvetica Neue'\r\n }\r\n });\r\ninputTextField.addEventListener('focus',function(){\r\n alert('focus');\r\n Ti.API.info('focus');\r\n});\r\ninputTextField.addEventListener('blur',function(){\r\n alert('blur');\r\n Ti.API.info('blur');\r\n});\r\ninputTextField.addEventListener('change',function(){\r\n alert('change');\r\n Ti.API.info('change');\r\n});\r\n\r\nwin.add(inputTextField);\r\nwin.open();\r\n{code}\r\n\r\n\r\nh3. Additional Notes:\r\nSet only one single event to be triggered.\r\n\r\nResult:\r\nonly the 'focus' event it's not behaving correctly:\r\nFirefox: focus event triggered, textField it's not being focused. Other events work fine.\r\nSafari: focus event triggered continuously. Other events work fine.\r\n\r\nHowever, there are issues when setting 'blur' and 'change' events together:\r\nFirefox: typing a character, also the blur event it's triggered (should be triggered only the change one)\r\nSafari: typing a character, the blur event it's triggered continuously (have to kill the browser in this case too)\r\n", "attachment": [], "flagged": false, "summary": "MobileWeb: textField events generate bad behaviors", "creator": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Firefox version 7.0.1\r\nSafari version 5.1.6 (7534.56.5)\r\nTiSDK 2.1.0.v20120621184154", "comment": { "comments": [ { "id": "199706", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "When you do an alert(), it blurs the text field. When you blur the textfield, it does an alert(). When you close the alert() it focuses the textfield, which does an alert() which blurs the textfield and so on.\r\n\r\nThis is just how the browser works. Don't use alert() for events. Use the console.\r\n\r\nIn my testing, if I remove the alerts, the change and blur events work just fine.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2012-06-21T23:13:59.000+0000", "updated": "2012-06-21T23:13:59.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }