{"action":"created","issue":{"url":"https://api.github.com/repos/cibernox/ember-power-select/issues/389","repository_url":"https://api.github.com/repos/cibernox/ember-power-select","labels_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/389/comments","events_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/389/events","html_url":"https://github.com/cibernox/ember-power-select/issues/389","id":142348992,"number":389,"title":"Custom Option-Elements broken","user":{"login":"Haidy777","id":5011101,"avatar_url":"https://avatars.githubusercontent.com/u/5011101?v=3","gravatar_id":"","url":"https://api.github.com/users/Haidy777","html_url":"https://github.com/Haidy777","followers_url":"https://api.github.com/users/Haidy777/followers","following_url":"https://api.github.com/users/Haidy777/following{/other_user}","gists_url":"https://api.github.com/users/Haidy777/gists{/gist_id}","starred_url":"https://api.github.com/users/Haidy777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Haidy777/subscriptions","organizations_url":"https://api.github.com/users/Haidy777/orgs","repos_url":"https://api.github.com/users/Haidy777/repos","events_url":"https://api.github.com/users/Haidy777/events{/privacy}","received_events_url":"https://api.github.com/users/Haidy777/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cibernox/ember-power-select/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-21T13:35:08Z","updated_at":"2016-03-21T16:30:58Z","closed_at":null,"body":"Since v0.10.0-beta.0 options with custom elements are broken.\r\n\r\nExample:\r\n```handlebars\r\n{{#power-select options=someList selected=selectedItem onchange=(action 'someAction') as |item|}}\r\n  <div class=\"special-class\">\r\n    <i class={{item.icon}}></i>\r\n    {{item.text}}\r\n  </div>\r\n{{/power-select}}\r\n```\r\n\r\nIf you click on the 'i'-Tag in the list, nothing happens.\r\nAfter some investigation i found out, why it doesn't work:\r\n\r\n[addon/components/power-select/options Line 19](https://github.com/cibernox/ember-power-select/blob/74202ee25bc189883edca130b75c76eb2eec9410/addon/components/power-select/options.js#L19)\r\n```javascript\r\nthis.element.addEventListener('mouseup', e => {\r\n  if (e.target.dataset.optionIndex) { // the clicked element 'i' doesn't have a data-option-index property\r\n    this.get('select.actions.choose')(this._optionFromIndex(e.target.dataset.optionIndex), e);\r\n  }\r\n});\r\n```\r\n\r\nThe clicked 'i' doesn't have a 'data-option-index'-Property, so the if gets passed by and nothing happens.\r\n\r\nThat could be solved with the little help of jquery:\r\n```javascript\r\nthis.element.addEventListener('mouseup', e => {\r\n  const optionIndex = Ember.$(e.target).closest('li').data('option-index').toString();\r\n  if(!isEmpty(optionIndex)){\r\n    this.get('select.actions.choose')(this._optionFromIndex(optionIndex), e);\r\n  }\r\n});\r\n```\r\n\r\nMaybe there is also another solution?"},"comment":{"url":"https://api.github.com/repos/cibernox/ember-power-select/issues/comments/199367826","html_url":"https://github.com/cibernox/ember-power-select/issues/389#issuecomment-199367826","issue_url":"https://api.github.com/repos/cibernox/ember-power-select/issues/389","id":199367826,"user":{"login":"Haidy777","id":5011101,"avatar_url":"https://avatars.githubusercontent.com/u/5011101?v=3","gravatar_id":"","url":"https://api.github.com/users/Haidy777","html_url":"https://github.com/Haidy777","followers_url":"https://api.github.com/users/Haidy777/followers","following_url":"https://api.github.com/users/Haidy777/following{/other_user}","gists_url":"https://api.github.com/users/Haidy777/gists{/gist_id}","starred_url":"https://api.github.com/users/Haidy777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Haidy777/subscriptions","organizations_url":"https://api.github.com/users/Haidy777/orgs","repos_url":"https://api.github.com/users/Haidy777/repos","events_url":"https://api.github.com/users/Haidy777/events{/privacy}","received_events_url":"https://api.github.com/users/Haidy777/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T16:30:58Z","updated_at":"2016-03-21T16:30:58Z","body":"@cibernox Thanks, that worked ;)"}}