{"action":"created","comment":{"url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/comments/35966488","id":35966488,"diff_hunk":"@@ -15,22 +17,33 @@ export default class MoreMenu extends React.Component {\n     this.state = { open: false };\n   }\n \n+  componentDidMount() {\n+    const subMenuElement = document.querySelector('.submenu');\n+    const menuElement = document.querySelector('.menu');\n+    document.addEventListener('click', (event) => {\n+      if (event.target !== subMenuElement && !subMenuElement.contains(event.target) &&\n+        event.target !== menuElement && !menuElement.contains(event.target)) {\n+        this.closeMenu();\n+      }\n+    });\n+  }","path":"index.es6","position":22,"original_position":22,"commit_id":"a5fc7b01567f177e5c237e6720f8a2256aec1568","original_commit_id":"a5fc7b01567f177e5c237e6720f8a2256aec1568","user":{"login":"russEco","id":4679852,"avatar_url":"https://avatars.githubusercontent.com/u/4679852?v=3","gravatar_id":"","url":"https://api.github.com/users/russEco","html_url":"https://github.com/russEco","followers_url":"https://api.github.com/users/russEco/followers","following_url":"https://api.github.com/users/russEco/following{/other_user}","gists_url":"https://api.github.com/users/russEco/gists{/gist_id}","starred_url":"https://api.github.com/users/russEco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russEco/subscriptions","organizations_url":"https://api.github.com/users/russEco/orgs","repos_url":"https://api.github.com/users/russEco/repos","events_url":"https://api.github.com/users/russEco/events{/privacy}","received_events_url":"https://api.github.com/users/russEco/received_events","type":"User","site_admin":false},"body":"Hmm maybe i think it would have to be .submenu as if it were .menu then it would close if you clicked anywhere on the submenu.","created_at":"2015-07-31T11:42:56Z","updated_at":"2015-07-31T11:42:56Z","html_url":"https://github.com/the-economist-editorial/component-moremenu/pull/1#discussion_r35966488","pull_request_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/comments/35966488"},"html":{"href":"https://github.com/the-economist-editorial/component-moremenu/pull/1#discussion_r35966488"},"pull_request":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1","id":41330874,"html_url":"https://github.com/the-economist-editorial/component-moremenu/pull/1","diff_url":"https://github.com/the-economist-editorial/component-moremenu/pull/1.diff","patch_url":"https://github.com/the-economist-editorial/component-moremenu/pull/1.patch","issue_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/1","number":1,"state":"open","locked":false,"title":"added event listener close when tapping outside of submenu","user":{"login":"russEco","id":4679852,"avatar_url":"https://avatars.githubusercontent.com/u/4679852?v=3","gravatar_id":"","url":"https://api.github.com/users/russEco","html_url":"https://github.com/russEco","followers_url":"https://api.github.com/users/russEco/followers","following_url":"https://api.github.com/users/russEco/following{/other_user}","gists_url":"https://api.github.com/users/russEco/gists{/gist_id}","starred_url":"https://api.github.com/users/russEco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russEco/subscriptions","organizations_url":"https://api.github.com/users/russEco/orgs","repos_url":"https://api.github.com/users/russEco/repos","events_url":"https://api.github.com/users/russEco/events{/privacy}","received_events_url":"https://api.github.com/users/russEco/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-31T11:33:14Z","updated_at":"2015-07-31T11:42:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b05f2f4ce374d36b7f2a824d33bf414869cf0f71","assignee":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1/commits","review_comments_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1/comments","review_comment_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/1/comments","statuses_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/statuses/a5fc7b01567f177e5c237e6720f8a2256aec1568","head":{"label":"the-economist-editorial:close-menu-eventlistner","ref":"close-menu-eventlistner","sha":"a5fc7b01567f177e5c237e6720f8a2256aec1568","user":{"login":"the-economist-editorial","id":5329285,"avatar_url":"https://avatars.githubusercontent.com/u/5329285?v=3","gravatar_id":"","url":"https://api.github.com/users/the-economist-editorial","html_url":"https://github.com/the-economist-editorial","followers_url":"https://api.github.com/users/the-economist-editorial/followers","following_url":"https://api.github.com/users/the-economist-editorial/following{/other_user}","gists_url":"https://api.github.com/users/the-economist-editorial/gists{/gist_id}","starred_url":"https://api.github.com/users/the-economist-editorial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-economist-editorial/subscriptions","organizations_url":"https://api.github.com/users/the-economist-editorial/orgs","repos_url":"https://api.github.com/users/the-economist-editorial/repos","events_url":"https://api.github.com/users/the-economist-editorial/events{/privacy}","received_events_url":"https://api.github.com/users/the-economist-editorial/received_events","type":"Organization","site_admin":false},"repo":{"id":38815771,"name":"component-moremenu","full_name":"the-economist-editorial/component-moremenu","owner":{"login":"the-economist-editorial","id":5329285,"avatar_url":"https://avatars.githubusercontent.com/u/5329285?v=3","gravatar_id":"","url":"https://api.github.com/users/the-economist-editorial","html_url":"https://github.com/the-economist-editorial","followers_url":"https://api.github.com/users/the-economist-editorial/followers","following_url":"https://api.github.com/users/the-economist-editorial/following{/other_user}","gists_url":"https://api.github.com/users/the-economist-editorial/gists{/gist_id}","starred_url":"https://api.github.com/users/the-economist-editorial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-economist-editorial/subscriptions","organizations_url":"https://api.github.com/users/the-economist-editorial/orgs","repos_url":"https://api.github.com/users/the-economist-editorial/repos","events_url":"https://api.github.com/users/the-economist-editorial/events{/privacy}","received_events_url":"https://api.github.com/users/the-economist-editorial/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/the-economist-editorial/component-moremenu","description":"","fork":false,"url":"https://api.github.com/repos/the-economist-editorial/component-moremenu","forks_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/forks","keys_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/teams","hooks_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/hooks","issue_events_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/events{/number}","events_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/events","assignees_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/assignees{/user}","branches_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/branches{/branch}","tags_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/tags","blobs_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/refs{/sha}","trees_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/statuses/{sha}","languages_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/languages","stargazers_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/stargazers","contributors_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/contributors","subscribers_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/subscribers","subscription_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/subscription","commits_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/commits{/sha}","git_commits_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/commits{/sha}","comments_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/comments{/number}","issue_comment_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/comments{/number}","contents_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/contents/{+path}","compare_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/merges","archive_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/downloads","issues_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues{/number}","pulls_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls{/number}","milestones_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/milestones{/number}","notifications_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/labels{/name}","releases_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/releases{/id}","created_at":"2015-07-09T11:12:40Z","updated_at":"2015-07-09T11:14:56Z","pushed_at":"2015-07-31T11:33:14Z","git_url":"git://github.com/the-economist-editorial/component-moremenu.git","ssh_url":"git@github.com:the-economist-editorial/component-moremenu.git","clone_url":"https://github.com/the-economist-editorial/component-moremenu.git","svn_url":"https://github.com/the-economist-editorial/component-moremenu","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"the-economist-editorial:master","ref":"master","sha":"e7e2a4d4b4a516aa99376830b8c506df0352b560","user":{"login":"the-economist-editorial","id":5329285,"avatar_url":"https://avatars.githubusercontent.com/u/5329285?v=3","gravatar_id":"","url":"https://api.github.com/users/the-economist-editorial","html_url":"https://github.com/the-economist-editorial","followers_url":"https://api.github.com/users/the-economist-editorial/followers","following_url":"https://api.github.com/users/the-economist-editorial/following{/other_user}","gists_url":"https://api.github.com/users/the-economist-editorial/gists{/gist_id}","starred_url":"https://api.github.com/users/the-economist-editorial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-economist-editorial/subscriptions","organizations_url":"https://api.github.com/users/the-economist-editorial/orgs","repos_url":"https://api.github.com/users/the-economist-editorial/repos","events_url":"https://api.github.com/users/the-economist-editorial/events{/privacy}","received_events_url":"https://api.github.com/users/the-economist-editorial/received_events","type":"Organization","site_admin":false},"repo":{"id":38815771,"name":"component-moremenu","full_name":"the-economist-editorial/component-moremenu","owner":{"login":"the-economist-editorial","id":5329285,"avatar_url":"https://avatars.githubusercontent.com/u/5329285?v=3","gravatar_id":"","url":"https://api.github.com/users/the-economist-editorial","html_url":"https://github.com/the-economist-editorial","followers_url":"https://api.github.com/users/the-economist-editorial/followers","following_url":"https://api.github.com/users/the-economist-editorial/following{/other_user}","gists_url":"https://api.github.com/users/the-economist-editorial/gists{/gist_id}","starred_url":"https://api.github.com/users/the-economist-editorial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-economist-editorial/subscriptions","organizations_url":"https://api.github.com/users/the-economist-editorial/orgs","repos_url":"https://api.github.com/users/the-economist-editorial/repos","events_url":"https://api.github.com/users/the-economist-editorial/events{/privacy}","received_events_url":"https://api.github.com/users/the-economist-editorial/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/the-economist-editorial/component-moremenu","description":"","fork":false,"url":"https://api.github.com/repos/the-economist-editorial/component-moremenu","forks_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/forks","keys_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/teams","hooks_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/hooks","issue_events_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/events{/number}","events_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/events","assignees_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/assignees{/user}","branches_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/branches{/branch}","tags_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/tags","blobs_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/refs{/sha}","trees_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/statuses/{sha}","languages_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/languages","stargazers_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/stargazers","contributors_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/contributors","subscribers_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/subscribers","subscription_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/subscription","commits_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/commits{/sha}","git_commits_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/git/commits{/sha}","comments_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/comments{/number}","issue_comment_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/comments{/number}","contents_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/contents/{+path}","compare_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/merges","archive_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/downloads","issues_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues{/number}","pulls_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls{/number}","milestones_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/milestones{/number}","notifications_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/labels{/name}","releases_url":"https://api.github.com/repos/the-economist-editorial/component-moremenu/releases{/id}","created_at":"2015-07-09T11:12:40Z","updated_at":"2015-07-09T11:14:56Z","pushed_at":"2015-07-31T11:33:14Z","git_url":"git://github.com/the-economist-editorial/component-moremenu.git","ssh_url":"git@github.com:the-economist-editorial/component-moremenu.git","clone_url":"https://github.com/the-economist-editorial/component-moremenu.git","svn_url":"https://github.com/the-economist-editorial/component-moremenu","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1"},"html":{"href":"https://github.com/the-economist-editorial/component-moremenu/pull/1"},"issue":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/1"},"comments":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/the-economist-editorial/component-moremenu/statuses/a5fc7b01567f177e5c237e6720f8a2256aec1568"}}}}