{"action":"created","issue":{"url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/186","labels_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/186/comments","events_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/186/events","html_url":"https://github.com/free-jqgrid/jqGrid/issues/186","id":122223753,"number":186,"title":"focusField sets focus to tabindex=-1 element in inline edit","user":{"login":"kobruleht","id":1274923,"avatar_url":"https://avatars.githubusercontent.com/u/1274923?v=3","gravatar_id":"","url":"https://api.github.com/users/kobruleht","html_url":"https://github.com/kobruleht","followers_url":"https://api.github.com/users/kobruleht/followers","following_url":"https://api.github.com/users/kobruleht/following{/other_user}","gists_url":"https://api.github.com/users/kobruleht/gists{/gist_id}","starred_url":"https://api.github.com/users/kobruleht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobruleht/subscriptions","organizations_url":"https://api.github.com/users/kobruleht/orgs","repos_url":"https://api.github.com/users/kobruleht/repos","events_url":"https://api.github.com/users/kobruleht/events{/privacy}","received_events_url":"https://api.github.com/users/kobruleht/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-15T09:02:05Z","updated_at":"2015-12-15T10:46:18Z","closed_at":null,"body":"If focusField: true is used, custom element contining tabindex=-1 button is in first column  and inline edit starts, focus is set to this element.\r\n\r\nElements with tabindex=-1 should not receive focus on editing.\r\n\r\nSource code contains\r\n\r\n\tgetFocusable = function (elem) {\r\n\t\t\treturn $(elem).find(\"input,textarea,select,button,object,*[tabindex]\")\r\n         .filter(\":input:visible:not(:disabled)\");\r\n\r\nSo jqgrid puts focus  to element even if it contains `tabindex=-1`\r\n\r\nTo reproduce, create first column as Jquery UI autocomplete dropdown using custom edit type.\r\nMade it  focusable using `focusField: true`\r\n\r\n    $.extend(true,$.jgrid.inlineEdit, {\r\n        position: \"beforeSelected\",\r\n        focusField: true,\r\n        keys: true } );\r\n\r\nIn jquery ui autocomplete dropdown autocomplete button is defined with tabindex=-1:\r\n\r\n    <button type='button' class='btn btn-default btn-form-dropdown' tabindex=-1 aria-label='Open menu'>\r\n    <span class='caret'></span></button>\r\n\r\nIt does not receive focus if tab key is pressed in inline edit.\r\n\r\nIf inline editing is started, jqgrid puts focus to autocomplete dropdown button.\r\nInstead focus should put to autocomplete input element.\r\n\r\nPosted also in http://stackoverflow.com/questions/34255210/how-to-set-focus-to-autocomplete-contents-on-inline-edit-in-free-jqgrid"},"comment":{"url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/comments/164723879","html_url":"https://github.com/free-jqgrid/jqGrid/issues/186#issuecomment-164723879","issue_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/186","id":164723879,"user":{"login":"OlegKi","id":249117,"avatar_url":"https://avatars.githubusercontent.com/u/249117?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegKi","html_url":"https://github.com/OlegKi","followers_url":"https://api.github.com/users/OlegKi/followers","following_url":"https://api.github.com/users/OlegKi/following{/other_user}","gists_url":"https://api.github.com/users/OlegKi/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegKi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegKi/subscriptions","organizations_url":"https://api.github.com/users/OlegKi/orgs","repos_url":"https://api.github.com/users/OlegKi/repos","events_url":"https://api.github.com/users/OlegKi/events{/privacy}","received_events_url":"https://api.github.com/users/OlegKi/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T10:46:18Z","updated_at":"2015-12-15T10:46:18Z","body":"I don't think that it's a bug of free jqGrid. I posted detailed answer on your question on the stackoverflow. Setting of `tabindex=-1` attribute do informs to make the element focusable, but one want to exclude it from *sequential focus navigation* (by <kbd>Tab</kbd> or <kbd>Shift+Tab</kbd>). See HTML5 specification [here](http://dev.w3.org/html5/spec-preview/editing.html#attr-tabindex) or to be exactly [here](http://dev.w3.org/html5/spec-preview/editing.html#negative-tabindex).\r\n\r\nYou can still change `focusField: true` option to some other integer or string value to set the focus on *some another column* addressed by column index or by column name."}}