{"action":"opened","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/1413","repository_url":"https://api.github.com/repos/lhorie/mithril.js","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1413/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1413/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1413/events","html_url":"https://github.com/lhorie/mithril.js/issues/1413","id":190574104,"number":1413,"title":"Select input lose temporarily focus on each redraw in chrome > 50","user":{"login":"veloce","id":423393,"avatar_url":"https://avatars.githubusercontent.com/u/423393?v=3","gravatar_id":"","url":"https://api.github.com/users/veloce","html_url":"https://github.com/veloce","followers_url":"https://api.github.com/users/veloce/followers","following_url":"https://api.github.com/users/veloce/following{/other_user}","gists_url":"https://api.github.com/users/veloce/gists{/gist_id}","starred_url":"https://api.github.com/users/veloce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veloce/subscriptions","organizations_url":"https://api.github.com/users/veloce/orgs","repos_url":"https://api.github.com/users/veloce/repos","events_url":"https://api.github.com/users/veloce/events{/privacy}","received_events_url":"https://api.github.com/users/veloce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-20T18:24:34Z","updated_at":"2016-11-20T18:24:34Z","closed_at":null,"body":"### Description:\r\n\r\nWhen the select has focus, each redraw occuring on the page will make the select dropdown close and reopen very quickly. As far as I know it was not an issue before chromium version 51.\r\n\r\nSee this jsbin to reproduce the issue:\r\nhttps://jsbin.com/fojijisada/edit?js,output\r\n\r\nOne workaround I found is to use a component to wrap the select input and use `onbeforeremove` like that to cancel redraw on the select (works with component used in above jsbin):\r\n```js\r\nonbeforeremove(vnode, old) {\r\n   return vnode.state !== old.state\r\n}\r\n```\r\n\r\n### Steps to Reproduce:\r\n\r\n```\r\nconst c = {\r\n  view() {\r\n    return m('div', [\r\n      m('p', 'redrawn ' + new Date()),\r\n      m(SelectComp)\r\n    ])\r\n  }\r\n}\r\n\r\nconst SelectComp = {\r\n  selected: null,\r\n  view({state}) {\r\n    return m('select', {\r\n      onchange: (e) => {\r\n        state.selected = e.target.value\r\n      }\r\n    }, [\r\n        m('option', { key: 'opt1', value: 'opt1', selected: state.selected === 'opt1'}, 'opt1'),\r\n        m('option', { key: 'opt2', value: 'opt2', selected: state.selected === 'opt2'}, 'opt2')\r\n    ])\r\n  }\r\n}\r\n\r\nm.mount(document.body, c)\r\n\r\nsetInterval(() => m.redraw(), 1000)\r\n```\r\n\r\n### Expected:\r\n\r\nThe select input don't lose focus and the dropdown remains open.\r\n\r\n### Actual:\r\n\r\nSelect loses focus on each redraw.\r\n\r\n\r\n"}}
{"actor":{"display_login":"veloce"}}