{"action":"created","issue":{"url":"https://api.github.com/repos/cibernox/ember-power-select/issues/318","repository_url":"https://api.github.com/repos/cibernox/ember-power-select","labels_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/318/labels{/name}","comments_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/318/comments","events_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/318/events","html_url":"https://github.com/cibernox/ember-power-select/issues/318","id":133276631,"number":318,"title":"Autofocus","user":{"login":"bakerac4","id":9952936,"avatar_url":"https://avatars.githubusercontent.com/u/9952936?v=3","gravatar_id":"","url":"https://api.github.com/users/bakerac4","html_url":"https://github.com/bakerac4","followers_url":"https://api.github.com/users/bakerac4/followers","following_url":"https://api.github.com/users/bakerac4/following{/other_user}","gists_url":"https://api.github.com/users/bakerac4/gists{/gist_id}","starred_url":"https://api.github.com/users/bakerac4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bakerac4/subscriptions","organizations_url":"https://api.github.com/users/bakerac4/orgs","repos_url":"https://api.github.com/users/bakerac4/repos","events_url":"https://api.github.com/users/bakerac4/events{/privacy}","received_events_url":"https://api.github.com/users/bakerac4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-12T16:00:47Z","updated_at":"2016-02-12T16:41:17Z","closed_at":null,"body":"I am trying to implement an autofocus attribute feature, so when it renders and I add an autofocus attribute, my power select will automatically be open and have the cursor ready to go\r\n\r\nHere is my power select\r\n```\r\n{{#power-select renderInPlace=true selected=productSelected\r\n                                    search=(action \"searchForProducts\") allowClear=true\r\n                                    placeholder=\"Search for Product\" onchange=(action (mut productSelected))\r\n                                    onfocus=(action \"selectFocused\") class=\"product-select\"\r\n                                    autofocus=\"autofocus\"\r\n                                    as |item|}}\r\n                        {{item.name}}\r\n                    {{/power-select}}\r\n```\r\n I was playing around with this, but I can't quite figure out how to force the power select to open. Do you know of a solution that would work?\r\n\r\n```\r\nimport Ember from 'ember';\r\nimport EmberPowerSelect from 'ember-power-select/components/power-select';\r\nexport function initialize(/* application */) {\r\n    EmberPowerSelect.reopen({\r\n        didInsertElement: function() {\r\n            this._super(...arguments);\r\n            Ember.run.next(() => {}\r\n                if (this.get('autofocus')) {\r\n                    \r\n\r\n                }\r\n            });\r\n        }\r\n    });\r\n}\r\n\r\nexport default {\r\n  name: 'power-select',\r\n  initialize\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/cibernox/ember-power-select/issues/comments/183401684","html_url":"https://github.com/cibernox/ember-power-select/issues/318#issuecomment-183401684","issue_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/318","id":183401684,"user":{"login":"cibernox","id":265339,"avatar_url":"https://avatars.githubusercontent.com/u/265339?v=3","gravatar_id":"","url":"https://api.github.com/users/cibernox","html_url":"https://github.com/cibernox","followers_url":"https://api.github.com/users/cibernox/followers","following_url":"https://api.github.com/users/cibernox/following{/other_user}","gists_url":"https://api.github.com/users/cibernox/gists{/gist_id}","starred_url":"https://api.github.com/users/cibernox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibernox/subscriptions","organizations_url":"https://api.github.com/users/cibernox/orgs","repos_url":"https://api.github.com/users/cibernox/repos","events_url":"https://api.github.com/users/cibernox/events{/privacy}","received_events_url":"https://api.github.com/users/cibernox/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T16:41:17Z","updated_at":"2016-02-12T16:41:17Z","body":"Reopening the component to add a `didInsertElement` can work. Inside that you can focus the trigger by it's id:\r\n```js\r\ndidInsertElement() {\r\n  this._super(...arguments);\r\n  document.getElementById(this.get('triggerId')).focus();\r\n}\r\n```\r\n\r\nAbout the automatically open the component on focus, there is one example in the docs:  http://www.ember-power-select.com/docs/action-handling"}}