{"action":"created","issue":{"url":"https://api.github.com/repos/atom/notifications/issues/59","labels_url":"https://api.github.com/repos/atom/notifications/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/atom/notifications/issues/59/comments","events_url":"https://api.github.com/repos/atom/notifications/issues/59/events","html_url":"https://github.com/atom/notifications/pull/59","id":75664910,"number":59,"title":"Focus active pane on notification removal only if the notification was focused","user":{"login":"izuzak","id":38924,"avatar_url":"https://avatars.githubusercontent.com/u/38924?v=3","gravatar_id":"","url":"https://api.github.com/users/izuzak","html_url":"https://github.com/izuzak","followers_url":"https://api.github.com/users/izuzak/followers","following_url":"https://api.github.com/users/izuzak/following{/other_user}","gists_url":"https://api.github.com/users/izuzak/gists{/gist_id}","starred_url":"https://api.github.com/users/izuzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izuzak/subscriptions","organizations_url":"https://api.github.com/users/izuzak/orgs","repos_url":"https://api.github.com/users/izuzak/repos","events_url":"https://api.github.com/users/izuzak/events{/privacy}","received_events_url":"https://api.github.com/users/izuzak/received_events","type":"User","site_admin":true},"labels":[{"url":"https://api.github.com/repos/atom/notifications/labels/needs-review","name":"needs-review","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T16:43:25Z","updated_at":"2015-05-22T09:47:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/atom/notifications/pulls/59","html_url":"https://github.com/atom/notifications/pull/59","diff_url":"https://github.com/atom/notifications/pull/59.diff","patch_url":"https://github.com/atom/notifications/pull/59.patch"},"body":"In https://github.com/atom/atom/issues/6439 a use-case was mentioned where dismissing a notification shouldn't focus the active pane -- programmatically dismissing a notification while some other panels are focused (e.g. the command palette). I think that makes sense and I think this change closes https://github.com/atom/atom/issues/6439.\r\n\r\nHere's a rundown of the commits:\r\n\r\n* 6a8617e adds a failing spec to demonstrate the problem pointed out in https://github.com/atom/atom/issues/6439. Running `apm test` at that commit produces this failure:\r\n\r\n  ```\r\nNotifications\r\n  when notifications are added to atom.notifications\r\n    when a dismissable notification is added\r\n      it focuses the active pane only if the dismissed notification has focus\r\n        Expected element '[object HTMLElement]' or its descendants to have focus.\r\n          at [object Object].<anonymous> (/Users/izuzak/github/notifications/spec/notifications-spec.coffee:152:40)\r\n          at _fulfilled (/Users/izuzak/github/atom/node_modules/q/q.js:794:54)\r\n          at self.promiseDispatch.done (/Users/izuzak/github/atom/node_modules/q/q.js:823:30)\r\n          at Promise.promise.promiseDispatch (/Users/izuzak/github/atom/node_modules/q/q.js:756:13)\r\n          at /Users/izuzak/github/atom/node_modules/q/q.js:564:44\r\n          at flush (/Users/izuzak/github/atom/node_modules/q/q.js:110:17)\r\n          at process._tickCallback (node.js:357:13)\r\n\r\n\r\nFinished in 14.885 seconds\r\n48 tests, 125 assertions, 1 failure, 0 skipped\r\n```\r\n\r\n* 2b5f9f7 fixes the failing spec by checking if the notification had focus when it's dismissed. If it does have focus -- then the active pane is focused. If it doesn't have focus -- then focus isn't touched (assuming that whatever has focus is what should have focus).\r\n\r\n* ff8eeaa moves the check + focus statement so that it's performed in every removal scenario, including notifications which were removed automatically after a timeout (non-dismissible notifications). This covers the case where a notification which is not dismissible is shown and the user clicks the notification, and after the timeout the notification is removed (and focus is now put to the active pane).\r\n\r\ncc @benogle @kevinsawicki for :eyes: "},"comment":{"url":"https://api.github.com/repos/atom/notifications/issues/comments/104599934","html_url":"https://github.com/atom/notifications/pull/59#issuecomment-104599934","issue_url":"https://api.github.com/repos/atom/notifications/issues/59","id":104599934,"user":{"login":"izuzak","id":38924,"avatar_url":"https://avatars.githubusercontent.com/u/38924?v=3","gravatar_id":"","url":"https://api.github.com/users/izuzak","html_url":"https://github.com/izuzak","followers_url":"https://api.github.com/users/izuzak/followers","following_url":"https://api.github.com/users/izuzak/following{/other_user}","gists_url":"https://api.github.com/users/izuzak/gists{/gist_id}","starred_url":"https://api.github.com/users/izuzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izuzak/subscriptions","organizations_url":"https://api.github.com/users/izuzak/orgs","repos_url":"https://api.github.com/users/izuzak/repos","events_url":"https://api.github.com/users/izuzak/events{/privacy}","received_events_url":"https://api.github.com/users/izuzak/received_events","type":"User","site_admin":true},"created_at":"2015-05-22T09:46:59Z","updated_at":"2015-05-22T09:46:59Z","body":"@benogle Just wondering if you have some :hourglass: to take a look at this one and see if it makes sense? "}}