{"action":"created","comment":{"url":"https://api.github.com/repos/github/details-menu-element/pulls/comments/215064352","pull_request_review_id":152250327,"id":215064352,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTA2NDM1Mg==","diff_hunk":"@@ -124,28 +124,33 @@ function keydown(event: KeyboardEvent) {\n   // Ignore key presses from nested details.\n   if (details.querySelector('details[open]')) return\n \n+  let target\n   switch (event.key) {\n     case 'Escape':\n       close(details)\n       event.preventDefault()\n       break\n     case 'ArrowDown':\n-      sibling(details, true).focus()\n+      target = sibling(details, true)\n+      if (target) target.focus()","path":"index.js","position":22,"original_position":22,"commit_id":"5d5bf22cd87d91cd2a02de7691891f9e311a48b2","original_commit_id":"5d5bf22cd87d91cd2a02de7691891f9e311a48b2","user":{"login":"dgraham","id":122102,"node_id":"MDQ6VXNlcjEyMjEwMg==","avatar_url":"https://avatars2.githubusercontent.com/u/122102?v=4","gravatar_id":"","url":"https://api.github.com/users/dgraham","html_url":"https://github.com/dgraham","followers_url":"https://api.github.com/users/dgraham/followers","following_url":"https://api.github.com/users/dgraham/following{/other_user}","gists_url":"https://api.github.com/users/dgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/dgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgraham/subscriptions","organizations_url":"https://api.github.com/users/dgraham/orgs","repos_url":"https://api.github.com/users/dgraham/repos","events_url":"https://api.github.com/users/dgraham/events{/privacy}","received_events_url":"https://api.github.com/users/dgraham/received_events","type":"User","site_admin":true},"body":"Creating a block inside the `case` branches will let us reduce the scope of `target`.\r\n\r\n```js\r\nswitch (event.key) {\r\n  case 'ArrowDown': { // <--- block scope here\r\n    const target = sibling(details, true)\r\n  }\r\n  break\r\n}\r\n```","created_at":"2018-09-04T20:56:44Z","updated_at":"2018-09-04T20:57:31Z","html_url":"https://github.com/github/details-menu-element/pull/12#discussion_r215064352","pull_request_url":"https://api.github.com/repos/github/details-menu-element/pulls/12","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/comments/215064352"},"html":{"href":"https://github.com/github/details-menu-element/pull/12#discussion_r215064352"},"pull_request":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/github/details-menu-element/pulls/12","id":213091480,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMDkxNDgw","html_url":"https://github.com/github/details-menu-element/pull/12","diff_url":"https://github.com/github/details-menu-element/pull/12.diff","patch_url":"https://github.com/github/details-menu-element/pull/12.patch","issue_url":"https://api.github.com/repos/github/details-menu-element/issues/12","number":12,"state":"open","locked":false,"title":"Fix exception thrown when no menu items are found","user":{"login":"muan","id":1153134,"node_id":"MDQ6VXNlcjExNTMxMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1153134?v=4","gravatar_id":"","url":"https://api.github.com/users/muan","html_url":"https://github.com/muan","followers_url":"https://api.github.com/users/muan/followers","following_url":"https://api.github.com/users/muan/following{/other_user}","gists_url":"https://api.github.com/users/muan/gists{/gist_id}","starred_url":"https://api.github.com/users/muan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muan/subscriptions","organizations_url":"https://api.github.com/users/muan/orgs","repos_url":"https://api.github.com/users/muan/repos","events_url":"https://api.github.com/users/muan/events{/privacy}","received_events_url":"https://api.github.com/users/muan/received_events","type":"User","site_admin":true},"body":"A menu can have only disabled menu items for valid reasons (perhaps dynamically enabled). In this case the code should just not move focus, instead of throwing an exception.\r\n\r\n## before\r\n\r\n![](https://cl.ly/546b4d7a0620/Screen%252520Recording%2525202018-09-04%252520at%25252004.14%252520PM.gif)\r\n\r\n## after\r\n\r\n![](https://cl.ly/55c5fce3d328/Screen%252520Recording%2525202018-09-04%252520at%25252004.12%252520PM.gif)","created_at":"2018-09-04T20:17:35Z","updated_at":"2018-09-04T20:57:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da809a654adf8ccbd52d1ad9cce9151ce3f747c5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/github/details-menu-element/pulls/12/commits","review_comments_url":"https://api.github.com/repos/github/details-menu-element/pulls/12/comments","review_comment_url":"https://api.github.com/repos/github/details-menu-element/pulls/comments{/number}","comments_url":"https://api.github.com/repos/github/details-menu-element/issues/12/comments","statuses_url":"https://api.github.com/repos/github/details-menu-element/statuses/5d5bf22cd87d91cd2a02de7691891f9e311a48b2","head":{"label":"github:noitems","ref":"noitems","sha":"5d5bf22cd87d91cd2a02de7691891f9e311a48b2","user":{"login":"github","id":9919,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9919?v=4","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":138936382,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MzYzODI=","name":"details-menu-element","full_name":"github/details-menu-element","owner":{"login":"github","id":9919,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9919?v=4","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/details-menu-element","description":"A menu opened with a <details> button.","fork":false,"url":"https://api.github.com/repos/github/details-menu-element","forks_url":"https://api.github.com/repos/github/details-menu-element/forks","keys_url":"https://api.github.com/repos/github/details-menu-element/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/details-menu-element/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/details-menu-element/teams","hooks_url":"https://api.github.com/repos/github/details-menu-element/hooks","issue_events_url":"https://api.github.com/repos/github/details-menu-element/issues/events{/number}","events_url":"https://api.github.com/repos/github/details-menu-element/events","assignees_url":"https://api.github.com/repos/github/details-menu-element/assignees{/user}","branches_url":"https://api.github.com/repos/github/details-menu-element/branches{/branch}","tags_url":"https://api.github.com/repos/github/details-menu-element/tags","blobs_url":"https://api.github.com/repos/github/details-menu-element/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/details-menu-element/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/details-menu-element/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/details-menu-element/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/details-menu-element/statuses/{sha}","languages_url":"https://api.github.com/repos/github/details-menu-element/languages","stargazers_url":"https://api.github.com/repos/github/details-menu-element/stargazers","contributors_url":"https://api.github.com/repos/github/details-menu-element/contributors","subscribers_url":"https://api.github.com/repos/github/details-menu-element/subscribers","subscription_url":"https://api.github.com/repos/github/details-menu-element/subscription","commits_url":"https://api.github.com/repos/github/details-menu-element/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/details-menu-element/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/details-menu-element/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/details-menu-element/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/details-menu-element/contents/{+path}","compare_url":"https://api.github.com/repos/github/details-menu-element/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/details-menu-element/merges","archive_url":"https://api.github.com/repos/github/details-menu-element/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/details-menu-element/downloads","issues_url":"https://api.github.com/repos/github/details-menu-element/issues{/number}","pulls_url":"https://api.github.com/repos/github/details-menu-element/pulls{/number}","milestones_url":"https://api.github.com/repos/github/details-menu-element/milestones{/number}","notifications_url":"https://api.github.com/repos/github/details-menu-element/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/details-menu-element/labels{/name}","releases_url":"https://api.github.com/repos/github/details-menu-element/releases{/id}","deployments_url":"https://api.github.com/repos/github/details-menu-element/deployments","created_at":"2018-06-27T21:48:29Z","updated_at":"2018-08-31T17:22:59Z","pushed_at":"2018-09-04T20:17:36Z","git_url":"git://github.com/github/details-menu-element.git","ssh_url":"git@github.com:github/details-menu-element.git","clone_url":"https://github.com/github/details-menu-element.git","svn_url":"https://github.com/github/details-menu-element","homepage":null,"size":318,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":2,"watchers":23,"default_branch":"master"}},"base":{"label":"github:master","ref":"master","sha":"47cd1486b02357e16a22b0a900b9ac8f665e21d3","user":{"login":"github","id":9919,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9919?v=4","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":138936382,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MzYzODI=","name":"details-menu-element","full_name":"github/details-menu-element","owner":{"login":"github","id":9919,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9919?v=4","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/details-menu-element","description":"A menu opened with a <details> button.","fork":false,"url":"https://api.github.com/repos/github/details-menu-element","forks_url":"https://api.github.com/repos/github/details-menu-element/forks","keys_url":"https://api.github.com/repos/github/details-menu-element/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/details-menu-element/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/details-menu-element/teams","hooks_url":"https://api.github.com/repos/github/details-menu-element/hooks","issue_events_url":"https://api.github.com/repos/github/details-menu-element/issues/events{/number}","events_url":"https://api.github.com/repos/github/details-menu-element/events","assignees_url":"https://api.github.com/repos/github/details-menu-element/assignees{/user}","branches_url":"https://api.github.com/repos/github/details-menu-element/branches{/branch}","tags_url":"https://api.github.com/repos/github/details-menu-element/tags","blobs_url":"https://api.github.com/repos/github/details-menu-element/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/details-menu-element/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/details-menu-element/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/details-menu-element/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/details-menu-element/statuses/{sha}","languages_url":"https://api.github.com/repos/github/details-menu-element/languages","stargazers_url":"https://api.github.com/repos/github/details-menu-element/stargazers","contributors_url":"https://api.github.com/repos/github/details-menu-element/contributors","subscribers_url":"https://api.github.com/repos/github/details-menu-element/subscribers","subscription_url":"https://api.github.com/repos/github/details-menu-element/subscription","commits_url":"https://api.github.com/repos/github/details-menu-element/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/details-menu-element/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/details-menu-element/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/details-menu-element/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/details-menu-element/contents/{+path}","compare_url":"https://api.github.com/repos/github/details-menu-element/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/details-menu-element/merges","archive_url":"https://api.github.com/repos/github/details-menu-element/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/details-menu-element/downloads","issues_url":"https://api.github.com/repos/github/details-menu-element/issues{/number}","pulls_url":"https://api.github.com/repos/github/details-menu-element/pulls{/number}","milestones_url":"https://api.github.com/repos/github/details-menu-element/milestones{/number}","notifications_url":"https://api.github.com/repos/github/details-menu-element/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/details-menu-element/labels{/name}","releases_url":"https://api.github.com/repos/github/details-menu-element/releases{/id}","deployments_url":"https://api.github.com/repos/github/details-menu-element/deployments","created_at":"2018-06-27T21:48:29Z","updated_at":"2018-08-31T17:22:59Z","pushed_at":"2018-09-04T20:17:36Z","git_url":"git://github.com/github/details-menu-element.git","ssh_url":"git@github.com:github/details-menu-element.git","clone_url":"https://github.com/github/details-menu-element.git","svn_url":"https://github.com/github/details-menu-element","homepage":null,"size":318,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":2,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/12"},"html":{"href":"https://github.com/github/details-menu-element/pull/12"},"issue":{"href":"https://api.github.com/repos/github/details-menu-element/issues/12"},"comments":{"href":"https://api.github.com/repos/github/details-menu-element/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/github/details-menu-element/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/github/details-menu-element/statuses/5d5bf22cd87d91cd2a02de7691891f9e311a48b2"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dgraham"}}