{"action":"opened","issue":{"url":"https://api.github.com/repos/react-component/checkbox/issues/47","repository_url":"https://api.github.com/repos/react-component/checkbox","labels_url":"https://api.github.com/repos/react-component/checkbox/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/react-component/checkbox/issues/47/comments","events_url":"https://api.github.com/repos/react-component/checkbox/issues/47/events","html_url":"https://github.com/react-component/checkbox/issues/47","id":348483937,"node_id":"MDU6SXNzdWUzNDg0ODM5Mzc=","number":47,"title":"expose `currentTarget` in `handleChange`","user":{"login":"goldylucks","id":6963212,"node_id":"MDQ6VXNlcjY5NjMyMTI=","avatar_url":"https://avatars3.githubusercontent.com/u/6963212?v=4","gravatar_id":"","url":"https://api.github.com/users/goldylucks","html_url":"https://github.com/goldylucks","followers_url":"https://api.github.com/users/goldylucks/followers","following_url":"https://api.github.com/users/goldylucks/following{/other_user}","gists_url":"https://api.github.com/users/goldylucks/gists{/gist_id}","starred_url":"https://api.github.com/users/goldylucks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldylucks/subscriptions","organizations_url":"https://api.github.com/users/goldylucks/orgs","repos_url":"https://api.github.com/users/goldylucks/repos","events_url":"https://api.github.com/users/goldylucks/events{/privacy}","received_events_url":"https://api.github.com/users/goldylucks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-07T20:55:45Z","updated_at":"2018-08-07T20:55:45Z","closed_at":null,"author_association":"NONE","body":"From [react/flow docs](https://flow.org/en/docs/react/events):\r\n> Note: To get the element instance, like HTMLButtonElement in the example above, it is a common mistake to use event.target instead of event.currentTarget. The reason why you want to use event.currentTarget is that event.target may be the wrong element due to event propagation.\r\n\r\n[Relevant code](https://github.com/react-component/checkbox/blob/master/src/Checkbox.jsx#L66-L89):\r\n```diff\r\n  handleChange = (e) => {\r\n    const { props } = this;\r\n    if (props.disabled) {\r\n      return;\r\n    }\r\n    if (!('checked' in props)) {\r\n      this.setState({\r\n        checked: e.target.checked,\r\n      });\r\n    }\r\n    props.onChange({\r\n+     currentTarget: e.currentTarget,\r\n      target: {\r\n        ...props,\r\n        checked: e.target.checked,\r\n      },\r\n      stopPropagation() {\r\n        e.stopPropagation();\r\n      },\r\n      preventDefault() {\r\n        e.preventDefault();\r\n      },\r\n      nativeEvent: e.nativeEvent,\r\n    });\r\n  };\r\n```"}}
{"actor":{"display_login":"goldylucks"}}