{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/71753183","id":71753183,"diff_hunk":"@@ -0,0 +1,45 @@\n+/**\n+ * External dependencies\n+ */\n+import includes from 'lodash/includes';\n+\n+/**\n+ * Internal dependencies\n+ */\n+import {\n+\tLAYOUT_FOCUS_SET,\n+\tLAYOUT_NEXT_FOCUS_ACTIVATE,\n+\tLAYOUT_NEXT_FOCUS_SET,\n+} from 'state/action-types';\n+import { setFocusHideClass } from 'lib/layout-focus';\n+\n+const initialState = { current: null, previous: null, next: null };\n+const validAreas = [ 'content', 'sidebar', 'sites', 'preview' ];\n+const isValidArea = area => includes( validAreas, area );\n+\n+export default function layoutFocus( state = initialState, action ) {\n+\tswitch ( action.type ) {\n+\t\tcase LAYOUT_FOCUS_SET:\n+\t\t\tif ( ! isValidArea( action.area ) ) {\n+\t\t\t\treturn state;\n+\t\t\t}\n+\t\t\tsetFocusHideClass();","path":"client/state/ui/layout-focus/reducer.js","position":26,"original_position":26,"commit_id":"1a409e961d200d38dfddfa78df7ac735415b8d1d","original_commit_id":"65f7889160fcb4b2e06dde31b1afb6cd029e928e","user":{"login":"aduth","id":1779930,"avatar_url":"https://avatars.githubusercontent.com/u/1779930?v=3","gravatar_id":"","url":"https://api.github.com/users/aduth","html_url":"https://github.com/aduth","followers_url":"https://api.github.com/users/aduth/followers","following_url":"https://api.github.com/users/aduth/following{/other_user}","gists_url":"https://api.github.com/users/aduth/gists{/gist_id}","starred_url":"https://api.github.com/users/aduth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduth/subscriptions","organizations_url":"https://api.github.com/users/aduth/orgs","repos_url":"https://api.github.com/users/aduth/repos","events_url":"https://api.github.com/users/aduth/events{/privacy}","received_events_url":"https://api.github.com/users/aduth/received_events","type":"User","site_admin":false},"body":"I took a closer look, and I don't think this class is even used anymore ([search](https://github.com/Automattic/wp-calypso/search?utf8=%E2%9C%93&q=focus-hide)). In fact, the original issue that this was trying to solve is now present once again, i.e. using browser search on sites section matches sites in Site picker even when site picker is not open (originally 2753-gh-calypso-pre-oss, cc @mtias). \r\n\r\nIf we _were_ to reintroduce this, I wonder if we could do it by monitoring the `currentLayout` state from the sidebar component itself to add and remove the class.\r\n\r\nIn the meantime, I think we should just remove all traces of `setFocusHideClass`.","created_at":"2016-07-21T17:49:33Z","updated_at":"2016-07-21T17:49:33Z","html_url":"https://github.com/Automattic/wp-calypso/pull/6765#discussion_r71753183","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/71753183"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/6765#discussion_r71753183"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765","id":77381701,"html_url":"https://github.com/Automattic/wp-calypso/pull/6765","diff_url":"https://github.com/Automattic/wp-calypso/pull/6765.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/6765.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/6765","number":6765,"state":"open","locked":false,"title":"Framework: use Redux for layoutFocus","user":{"login":"sirbrillig","id":2036909,"avatar_url":"https://avatars.githubusercontent.com/u/2036909?v=3","gravatar_id":"","url":"https://api.github.com/users/sirbrillig","html_url":"https://github.com/sirbrillig","followers_url":"https://api.github.com/users/sirbrillig/followers","following_url":"https://api.github.com/users/sirbrillig/following{/other_user}","gists_url":"https://api.github.com/users/sirbrillig/gists{/gist_id}","starred_url":"https://api.github.com/users/sirbrillig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirbrillig/subscriptions","organizations_url":"https://api.github.com/users/sirbrillig/orgs","repos_url":"https://api.github.com/users/sirbrillig/repos","events_url":"https://api.github.com/users/sirbrillig/events{/privacy}","received_events_url":"https://api.github.com/users/sirbrillig/received_events","type":"User","site_admin":false},"body":"This PR aims to replace the `layoutFocus` module (a Flux store) with `state.ui.layoutFocus` in the Redux state tree, along with the appropriate actions and selectors.\r\n\r\nThe old Flux store module will now call the new Redux actions and selectors for its methods. There is only one place in the code (that I could find) where a component observes the Flux store for changes (`Layout`), and that has been updated to use a selector instead.\r\n\r\nThe old methods, with their replacements (note that the actions will require a dispatcher):\r\n\r\n- `layoutFocus.set( area )` -> `setLayoutFocus( area )` (action)\r\n- `layoutFocus.setNext( area )` -> `setNextLayoutFocus( area )` (action)\r\n- `layoutFocus.next()` -> `activateNextLayoutFocus()` (action)\r\n- `layoutFocus.getCurrent()` -> `getCurrentLayoutFocus( state )`\r\n- `layoutFocus.getPrevious()` -> `getPreviousLayoutFocus( state )`\r\n- `layoutFocus._next` -> `getNextLayoutFocus( state )`\r\n\r\n### Testing\r\n\r\nFirst, make sure that when visiting a my-sites page, clicking on the site selector (\"switch site\") still works as expected (switches the focus to `sites` and then back to `content` when done).\r\n\r\nSecond, when visiting a my-sites page, adding `?sp` in the querystring should focus the sites list.\r\n\r\nThe code is calling the `setLayoutFocus()` method, which, if you see the sites list active, means that it updated the Flux store. Then check the Redux store (eg: using Redux Devtools) and be sure that `state.ui.layoutFocus.current` has been changed to 'sites'.\r\n\r\nTest live: https://calypso.live/?branch=update/use-redux-for-layout-focus","created_at":"2016-07-14T00:04:10Z","updated_at":"2016-07-21T17:49:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"197aad604d6bc84feeda92ce56947d931f55295f","assignee":{"login":"sirbrillig","id":2036909,"avatar_url":"https://avatars.githubusercontent.com/u/2036909?v=3","gravatar_id":"","url":"https://api.github.com/users/sirbrillig","html_url":"https://github.com/sirbrillig","followers_url":"https://api.github.com/users/sirbrillig/followers","following_url":"https://api.github.com/users/sirbrillig/following{/other_user}","gists_url":"https://api.github.com/users/sirbrillig/gists{/gist_id}","starred_url":"https://api.github.com/users/sirbrillig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirbrillig/subscriptions","organizations_url":"https://api.github.com/users/sirbrillig/orgs","repos_url":"https://api.github.com/users/sirbrillig/repos","events_url":"https://api.github.com/users/sirbrillig/events{/privacy}","received_events_url":"https://api.github.com/users/sirbrillig/received_events","type":"User","site_admin":false},"assignees":[{"login":"sirbrillig","id":2036909,"avatar_url":"https://avatars.githubusercontent.com/u/2036909?v=3","gravatar_id":"","url":"https://api.github.com/users/sirbrillig","html_url":"https://github.com/sirbrillig","followers_url":"https://api.github.com/users/sirbrillig/followers","following_url":"https://api.github.com/users/sirbrillig/following{/other_user}","gists_url":"https://api.github.com/users/sirbrillig/gists{/gist_id}","starred_url":"https://api.github.com/users/sirbrillig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirbrillig/subscriptions","organizations_url":"https://api.github.com/users/sirbrillig/orgs","repos_url":"https://api.github.com/users/sirbrillig/repos","events_url":"https://api.github.com/users/sirbrillig/events{/privacy}","received_events_url":"https://api.github.com/users/sirbrillig/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765/comments","review_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/6765/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/1a409e961d200d38dfddfa78df7ac735415b8d1d","head":{"label":"Automattic:update/use-redux-for-layout-focus","ref":"update/use-redux-for-layout-focus","sha":"1a409e961d200d38dfddfa78df7ac735415b8d1d","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-07-21T12:55:07Z","pushed_at":"2016-07-21T17:43:20Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":82319,"stargazers_count":7592,"watchers_count":7592,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":946,"mirror_url":null,"open_issues_count":1338,"forks":946,"open_issues":1338,"watchers":7592,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"ca92df00ad795788470b1d994471ad2087f54fff","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-07-21T12:55:07Z","pushed_at":"2016-07-21T17:43:20Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":82319,"stargazers_count":7592,"watchers_count":7592,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":946,"mirror_url":null,"open_issues_count":1338,"forks":946,"open_issues":1338,"watchers":7592,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/6765"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/6765"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/6765/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/6765/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/1a409e961d200d38dfddfa78df7ac735415b8d1d"}}}}
{"actor":{"display_login":"aduth"}}