{"action":"created","issue":{"url":"https://api.github.com/repos/extnet/Ext.NET/issues/1441","repository_url":"https://api.github.com/repos/extnet/Ext.NET","labels_url":"https://api.github.com/repos/extnet/Ext.NET/issues/1441/labels{/name}","comments_url":"https://api.github.com/repos/extnet/Ext.NET/issues/1441/comments","events_url":"https://api.github.com/repos/extnet/Ext.NET/issues/1441/events","html_url":"https://github.com/extnet/Ext.NET/issues/1441","id":209201822,"number":1441,"title":"SelectOnFocus for text fields (TextArea, TextField) is ignored (always true)","user":{"login":"fabriciomurta","id":10730372,"avatar_url":"https://avatars2.githubusercontent.com/u/10730372?v=4","gravatar_id":"","url":"https://api.github.com/users/fabriciomurta","html_url":"https://github.com/fabriciomurta","followers_url":"https://api.github.com/users/fabriciomurta/followers","following_url":"https://api.github.com/users/fabriciomurta/following{/other_user}","gists_url":"https://api.github.com/users/fabriciomurta/gists{/gist_id}","starred_url":"https://api.github.com/users/fabriciomurta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabriciomurta/subscriptions","organizations_url":"https://api.github.com/users/fabriciomurta/orgs","repos_url":"https://api.github.com/users/fabriciomurta/repos","events_url":"https://api.github.com/users/fabriciomurta/events{/privacy}","received_events_url":"https://api.github.com/users/fabriciomurta/received_events","type":"User","site_admin":false},"labels":[{"id":293977477,"url":"https://api.github.com/repos/extnet/Ext.NET/labels/4.x","name":"4.x","color":"bfd4f2","default":false},{"id":316478476,"url":"https://api.github.com/repos/extnet/Ext.NET/labels/defect","name":"defect","color":"FF4136","default":false},{"id":305715885,"url":"https://api.github.com/repos/extnet/Ext.NET/labels/fixed-in-latest-extjs","name":"fixed-in-latest-extjs","color":"d2f2d2","default":false},{"id":19454629,"url":"https://api.github.com/repos/extnet/Ext.NET/labels/sencha","name":"sencha","color":"FF4136","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/extnet/Ext.NET/milestones/29","html_url":"https://github.com/extnet/Ext.NET/milestone/29","labels_url":"https://api.github.com/repos/extnet/Ext.NET/milestones/29/labels","id":2527600,"number":29,"title":"4.3.0","description":"","creator":{"login":"geoffreymcgill","id":62210,"avatar_url":"https://avatars1.githubusercontent.com/u/62210?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffreymcgill","html_url":"https://github.com/geoffreymcgill","followers_url":"https://api.github.com/users/geoffreymcgill/followers","following_url":"https://api.github.com/users/geoffreymcgill/following{/other_user}","gists_url":"https://api.github.com/users/geoffreymcgill/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffreymcgill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffreymcgill/subscriptions","organizations_url":"https://api.github.com/users/geoffreymcgill/orgs","repos_url":"https://api.github.com/users/geoffreymcgill/repos","events_url":"https://api.github.com/users/geoffreymcgill/events{/privacy}","received_events_url":"https://api.github.com/users/geoffreymcgill/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":22,"state":"closed","created_at":"2017-05-17T18:46:51Z","updated_at":"2017-08-08T19:29:40Z","due_on":null,"closed_at":"2017-08-08T19:29:40Z"},"comments":3,"created_at":"2017-02-21T16:39:25Z","updated_at":"2017-09-14T22:16:48Z","closed_at":"2017-07-21T19:13:47Z","author_association":"CONTRIBUTOR","body":"Found: 4.2.0\r\nExt.NET Thread: [SelectText problem](http://forums.ext.net/showthread.php?61783)\r\nSencha thread (assumed as fixed but seems fix is not perfect): [ExtJS 6.0.2: Text fields focus on select regardless of selectOnFocus config](https://www.sencha.com/forum/showthread.php?310439)\r\n\r\nIn either `Ext.Net.TextArea` or `Ext.Net.TextField`, focusing the field always selects all the text in the input field, ignoring the `SelectOnFocus` setting. The sencha thread above says it has been fixed in ExtJS as of 6.0.3 (thus 6.2.0 and 6.2.1) but according to [post #8 on sencha thread above](https://www.sencha.com/forum/showthread.php?310439&p=1170408&viewfull=1#post1170408), the fix also introduces an issue where the cursor is always moved to the end -- which would likely prevent the `selectText()` method from working.\r\n\r\nThe same post mentioned above also suggested an override that works nicely with the test case provided. A reviewed test case with the provided in Ext.NET thread and the override from Sencha thread would be:\r\n\r\n```xml\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<!DOCTYPE html>\r\n\r\n<html>\r\n<head runat=\"server\">\r\n    <title>61783v4 - selectText() issue</title>\r\n    <script type=\"text/javascript\">\r\n        // solution from: https://www.sencha.com/forum/showthread.php?310439&p=1170408&viewfull=1#post1170408\r\n        Ext.define('MyApp.overrides.form.field.Text', {\r\n            override: 'Ext.form.field.Text',\r\n            onFocus: function (e) {\r\n                var me = this,\r\n                    inputEl = me.inputEl.dom,\r\n                    startValue, value, len;\r\n\r\n                // Changing call to callSuper instead of callParent to skip the original method\r\n                me.callSuper([e]);\r\n\r\n                // Added check for selectOnFocus\r\n                if (me.selectOnFocus) {\r\n                    // This handler may be called when the focus has already shifted to another element;\r\n                    // calling inputEl.select() will forcibly focus again it which in turn might set up\r\n                    // a nasty circular race condition if focusEl !== inputEl.\r\n                    if (!me.focusTimer) {\r\n                        startValue = inputEl.value;\r\n                        me.focusTimer = Ext.asap(function () {\r\n                            me.focusTimer = null;\r\n                            // This ensures the carret will be at the end of the input element\r\n                            // while tabbing between editors.\r\n                            if (!me.destroyed && document.activeElement === inputEl) {\r\n                                value = inputEl.value;\r\n                                len = value.length;\r\n\r\n                                // If focusing has fired an event which mutated the value,\r\n                                // place the caret at the end. Else select the initial text\r\n                                // as is the HTML default behaviour.\r\n                                me.selectText(value !== startValue ? len : 0, len);\r\n                            }\r\n                        });\r\n                    }\r\n                }\r\n\r\n\r\n                if (me.emptyText) {\r\n                    me.autoSize();\r\n                }\r\n\r\n                me.addCls(me.fieldFocusCls);\r\n                me.triggerWrap.addCls(me.triggerWrapFocusCls);\r\n                me.inputWrap.addCls(me.inputWrapFocusCls);\r\n                me.invokeTriggers('onFieldFocus', [e]);\r\n            }\r\n        });\r\n    </script>\r\n</head>\r\n<body>\r\n    <ext:ResourceManager runat=\"server\"/>\r\n    <ext:TextArea\r\n        ID=\"txtA1\"\r\n        runat=\"server\"\r\n        Height=\"70\"\r\n        Width=\"710\"\r\n        MaxLength=\"1000\"\r\n        EnforceMaxLength=\"true\"\r\n        Text=\"lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum \"\r\n        SelectOnFocus=\"true\"\r\n         />\r\n\r\n    <ext:Button ID=\"Button2\" runat=\"server\" Text=\"Select\" >\r\n        <Listeners>\r\n            <Click Handler=\"App.txtA1.focus(); App.txtA1.selectText(5,9);\" />\r\n            <Focus Handler=\"return false;\" />\r\n        </Listeners>\r\n    </ext:Button>\r\n</body>\r\n</html>\r\n```\r\n\r\nThe Sencha forum thread evolves for having the issue partly fixed in a nightly build after 6.2.1 by jan 10th 2017, and support team double checks the bug has been fixed in the nightly by feb 9th 2017."},"comment":{"url":"https://api.github.com/repos/extnet/Ext.NET/issues/comments/329624125","html_url":"https://github.com/extnet/Ext.NET/issues/1441#issuecomment-329624125","issue_url":"https://api.github.com/repos/extnet/Ext.NET/issues/1441","id":329624125,"user":{"login":"fabriciomurta","id":10730372,"avatar_url":"https://avatars2.githubusercontent.com/u/10730372?v=4","gravatar_id":"","url":"https://api.github.com/users/fabriciomurta","html_url":"https://github.com/fabriciomurta","followers_url":"https://api.github.com/users/fabriciomurta/followers","following_url":"https://api.github.com/users/fabriciomurta/following{/other_user}","gists_url":"https://api.github.com/users/fabriciomurta/gists{/gist_id}","starred_url":"https://api.github.com/users/fabriciomurta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabriciomurta/subscriptions","organizations_url":"https://api.github.com/users/fabriciomurta/orgs","repos_url":"https://api.github.com/users/fabriciomurta/repos","events_url":"https://api.github.com/users/fabriciomurta/events{/privacy}","received_events_url":"https://api.github.com/users/fabriciomurta/received_events","type":"User","site_admin":false},"created_at":"2017-09-14T22:16:48Z","updated_at":"2017-09-14T22:16:48Z","author_association":"CONTRIBUTOR","body":"**Update:** Sencha issue _EXTJS-20985_ allegedly fixed in ExtJS 6.0.3 release."}}
{"actor":{"display_login":"fabriciomurta"}}