{"action":"created","comment":{"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/comments/80040860","id":80040860,"diff_hunk":"@@ -82,28 +84,47 @@ export class NgbDropdown {\n   /**\n    * @internal\n    */\n-  closeFromOutside() {\n+  closeFromOutsideClick($event) {\n+    if (this.autoClose && !this._isEventFromToggle($event)) {\n+      this.close();\n+    }\n+  }\n+\n+  /**\n+   * @internal\n+   */\n+  closeFromOutsideEsc() {\n     if (this.autoClose) {\n       this.close();\n     }\n   }\n+\n+  /**\n+   * @internal\n+   */\n+  set toggleElement(toggleElement: any) { this._toggleElement = toggleElement; }\n+\n+  private _isEventFromToggle($event) { return $event.target === this._toggleElement; }","path":"src/dropdown/dropdown.ts","position":47,"original_position":47,"commit_id":"370459c999767a77f082577337d337ab87017781","original_commit_id":"370459c999767a77f082577337d337ab87017781","user":{"login":"pkozlowski-opensource","id":973550,"avatar_url":"https://avatars.githubusercontent.com/u/973550?v=3","gravatar_id":"","url":"https://api.github.com/users/pkozlowski-opensource","html_url":"https://github.com/pkozlowski-opensource","followers_url":"https://api.github.com/users/pkozlowski-opensource/followers","following_url":"https://api.github.com/users/pkozlowski-opensource/following{/other_user}","gists_url":"https://api.github.com/users/pkozlowski-opensource/gists{/gist_id}","starred_url":"https://api.github.com/users/pkozlowski-opensource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkozlowski-opensource/subscriptions","organizations_url":"https://api.github.com/users/pkozlowski-opensource/orgs","repos_url":"https://api.github.com/users/pkozlowski-opensource/repos","events_url":"https://api.github.com/users/pkozlowski-opensource/events{/privacy}","received_events_url":"https://api.github.com/users/pkozlowski-opensource/received_events","type":"User","site_admin":false},"body":"Nope. I want to precisely capture clicks on a toggle button. Changing this to `this._toggleElement.contains($event.target)` would also capture menu items clicks which is not what we want.","created_at":"2016-09-22T13:35:03Z","updated_at":"2016-09-22T13:35:03Z","html_url":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785#discussion_r80040860","pull_request_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785","_links":{"self":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/comments/80040860"},"html":{"href":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785#discussion_r80040860"},"pull_request":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785"}}},"pull_request":{"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785","id":86333055,"html_url":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785","diff_url":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785.diff","patch_url":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785.patch","issue_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/785","number":785,"state":"open","locked":false,"title":"fix(dropdown): support autoClose when several dropdowns exist","user":{"login":"pkozlowski-opensource","id":973550,"avatar_url":"https://avatars.githubusercontent.com/u/973550?v=3","gravatar_id":"","url":"https://api.github.com/users/pkozlowski-opensource","html_url":"https://github.com/pkozlowski-opensource","followers_url":"https://api.github.com/users/pkozlowski-opensource/followers","following_url":"https://api.github.com/users/pkozlowski-opensource/following{/other_user}","gists_url":"https://api.github.com/users/pkozlowski-opensource/gists{/gist_id}","starred_url":"https://api.github.com/users/pkozlowski-opensource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkozlowski-opensource/subscriptions","organizations_url":"https://api.github.com/users/pkozlowski-opensource/orgs","repos_url":"https://api.github.com/users/pkozlowski-opensource/repos","events_url":"https://api.github.com/users/pkozlowski-opensource/events{/privacy}","received_events_url":"https://api.github.com/users/pkozlowski-opensource/received_events","type":"User","site_admin":false},"body":"The essence of the trick is that now we can distinguish clicks coming from the dropdown toggle element and not interpret those as external clicks.\r\n\r\nFixes #687","created_at":"2016-09-22T13:04:01Z","updated_at":"2016-09-22T13:35:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a680e4a8a687dfa1ef60112a6121ce281911828","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785/commits","review_comments_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785/comments","review_comment_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/785/comments","statuses_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/statuses/370459c999767a77f082577337d337ab87017781","head":{"label":"pkozlowski-opensource:dropdowns_more_than_one","ref":"dropdowns_more_than_one","sha":"370459c999767a77f082577337d337ab87017781","user":{"login":"pkozlowski-opensource","id":973550,"avatar_url":"https://avatars.githubusercontent.com/u/973550?v=3","gravatar_id":"","url":"https://api.github.com/users/pkozlowski-opensource","html_url":"https://github.com/pkozlowski-opensource","followers_url":"https://api.github.com/users/pkozlowski-opensource/followers","following_url":"https://api.github.com/users/pkozlowski-opensource/following{/other_user}","gists_url":"https://api.github.com/users/pkozlowski-opensource/gists{/gist_id}","starred_url":"https://api.github.com/users/pkozlowski-opensource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkozlowski-opensource/subscriptions","organizations_url":"https://api.github.com/users/pkozlowski-opensource/orgs","repos_url":"https://api.github.com/users/pkozlowski-opensource/repos","events_url":"https://api.github.com/users/pkozlowski-opensource/events{/privacy}","received_events_url":"https://api.github.com/users/pkozlowski-opensource/received_events","type":"User","site_admin":false},"repo":{"id":45191264,"name":"core","full_name":"pkozlowski-opensource/core","owner":{"login":"pkozlowski-opensource","id":973550,"avatar_url":"https://avatars.githubusercontent.com/u/973550?v=3","gravatar_id":"","url":"https://api.github.com/users/pkozlowski-opensource","html_url":"https://github.com/pkozlowski-opensource","followers_url":"https://api.github.com/users/pkozlowski-opensource/followers","following_url":"https://api.github.com/users/pkozlowski-opensource/following{/other_user}","gists_url":"https://api.github.com/users/pkozlowski-opensource/gists{/gist_id}","starred_url":"https://api.github.com/users/pkozlowski-opensource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkozlowski-opensource/subscriptions","organizations_url":"https://api.github.com/users/pkozlowski-opensource/orgs","repos_url":"https://api.github.com/users/pkozlowski-opensource/repos","events_url":"https://api.github.com/users/pkozlowski-opensource/events{/privacy}","received_events_url":"https://api.github.com/users/pkozlowski-opensource/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pkozlowski-opensource/core","description":"Angular 2 powered Bootstrap","fork":true,"url":"https://api.github.com/repos/pkozlowski-opensource/core","forks_url":"https://api.github.com/repos/pkozlowski-opensource/core/forks","keys_url":"https://api.github.com/repos/pkozlowski-opensource/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pkozlowski-opensource/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pkozlowski-opensource/core/teams","hooks_url":"https://api.github.com/repos/pkozlowski-opensource/core/hooks","issue_events_url":"https://api.github.com/repos/pkozlowski-opensource/core/issues/events{/number}","events_url":"https://api.github.com/repos/pkozlowski-opensource/core/events","assignees_url":"https://api.github.com/repos/pkozlowski-opensource/core/assignees{/user}","branches_url":"https://api.github.com/repos/pkozlowski-opensource/core/branches{/branch}","tags_url":"https://api.github.com/repos/pkozlowski-opensource/core/tags","blobs_url":"https://api.github.com/repos/pkozlowski-opensource/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pkozlowski-opensource/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pkozlowski-opensource/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/pkozlowski-opensource/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pkozlowski-opensource/core/statuses/{sha}","languages_url":"https://api.github.com/repos/pkozlowski-opensource/core/languages","stargazers_url":"https://api.github.com/repos/pkozlowski-opensource/core/stargazers","contributors_url":"https://api.github.com/repos/pkozlowski-opensource/core/contributors","subscribers_url":"https://api.github.com/repos/pkozlowski-opensource/core/subscribers","subscription_url":"https://api.github.com/repos/pkozlowski-opensource/core/subscription","commits_url":"https://api.github.com/repos/pkozlowski-opensource/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/pkozlowski-opensource/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/pkozlowski-opensource/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/pkozlowski-opensource/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/pkozlowski-opensource/core/contents/{+path}","compare_url":"https://api.github.com/repos/pkozlowski-opensource/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pkozlowski-opensource/core/merges","archive_url":"https://api.github.com/repos/pkozlowski-opensource/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pkozlowski-opensource/core/downloads","issues_url":"https://api.github.com/repos/pkozlowski-opensource/core/issues{/number}","pulls_url":"https://api.github.com/repos/pkozlowski-opensource/core/pulls{/number}","milestones_url":"https://api.github.com/repos/pkozlowski-opensource/core/milestones{/number}","notifications_url":"https://api.github.com/repos/pkozlowski-opensource/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pkozlowski-opensource/core/labels{/name}","releases_url":"https://api.github.com/repos/pkozlowski-opensource/core/releases{/id}","deployments_url":"https://api.github.com/repos/pkozlowski-opensource/core/deployments","created_at":"2015-10-29T15:13:07Z","updated_at":"2016-08-23T13:21:30Z","pushed_at":"2016-09-22T13:02:46Z","git_url":"git://github.com/pkozlowski-opensource/core.git","ssh_url":"git@github.com:pkozlowski-opensource/core.git","clone_url":"https://github.com/pkozlowski-opensource/core.git","svn_url":"https://github.com/pkozlowski-opensource/core","homepage":null,"size":1048,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"ng-bootstrap:master","ref":"master","sha":"40bde5e09d292cc714e41b1783c5bcb8e1cbd067","user":{"login":"ng-bootstrap","id":14283866,"avatar_url":"https://avatars.githubusercontent.com/u/14283866?v=3","gravatar_id":"","url":"https://api.github.com/users/ng-bootstrap","html_url":"https://github.com/ng-bootstrap","followers_url":"https://api.github.com/users/ng-bootstrap/followers","following_url":"https://api.github.com/users/ng-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/ng-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/ng-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ng-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/ng-bootstrap/orgs","repos_url":"https://api.github.com/users/ng-bootstrap/repos","events_url":"https://api.github.com/users/ng-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/ng-bootstrap/received_events","type":"Organization","site_admin":false},"repo":{"id":42481664,"name":"ng-bootstrap","full_name":"ng-bootstrap/ng-bootstrap","owner":{"login":"ng-bootstrap","id":14283866,"avatar_url":"https://avatars.githubusercontent.com/u/14283866?v=3","gravatar_id":"","url":"https://api.github.com/users/ng-bootstrap","html_url":"https://github.com/ng-bootstrap","followers_url":"https://api.github.com/users/ng-bootstrap/followers","following_url":"https://api.github.com/users/ng-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/ng-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/ng-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ng-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/ng-bootstrap/orgs","repos_url":"https://api.github.com/users/ng-bootstrap/repos","events_url":"https://api.github.com/users/ng-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/ng-bootstrap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ng-bootstrap/ng-bootstrap","description":"Angular 2 powered Bootstrap","fork":false,"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap","forks_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/forks","keys_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/teams","hooks_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/hooks","issue_events_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/events{/number}","events_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/events","assignees_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/assignees{/user}","branches_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/branches{/branch}","tags_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/tags","blobs_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/git/refs{/sha}","trees_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/statuses/{sha}","languages_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/languages","stargazers_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/stargazers","contributors_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/contributors","subscribers_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/subscribers","subscription_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/subscription","commits_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/commits{/sha}","git_commits_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/git/commits{/sha}","comments_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/comments{/number}","issue_comment_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/comments{/number}","contents_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/contents/{+path}","compare_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/merges","archive_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/downloads","issues_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues{/number}","pulls_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls{/number}","milestones_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/milestones{/number}","notifications_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/labels{/name}","releases_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/releases{/id}","deployments_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/deployments","created_at":"2015-09-14T22:55:53Z","updated_at":"2016-09-22T12:56:01Z","pushed_at":"2016-09-22T13:04:02Z","git_url":"git://github.com/ng-bootstrap/ng-bootstrap.git","ssh_url":"git@github.com:ng-bootstrap/ng-bootstrap.git","clone_url":"https://github.com/ng-bootstrap/ng-bootstrap.git","svn_url":"https://github.com/ng-bootstrap/ng-bootstrap","homepage":"https://ng-bootstrap.github.io","size":1391,"stargazers_count":962,"watchers_count":962,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":54,"forks":148,"open_issues":54,"watchers":962,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785"},"html":{"href":"https://github.com/ng-bootstrap/ng-bootstrap/pull/785"},"issue":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/785"},"comments":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/785/comments"},"review_comments":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785/comments"},"review_comment":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/pulls/785/commits"},"statuses":{"href":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/statuses/370459c999767a77f082577337d337ab87017781"}}}}
{"actor":{"display_login":"pkozlowski-opensource"}}