{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/30568165","id":30568165,"diff_hunk":"@@ -61,47 +49,34 @@\n       case 'mozbrowsercontextmenu':\n         this.show(evt);\n         break;\n+      case 'modal-dialog-opened':\n+        focusManager.focus();\n+        this.app.publish('contextmenu-shown');\n+        break;\n+      case 'modal-dialog-closed':\n+        this.app.publish('contextmenu-hidden');\n+        focusManager.focus();\n+        break;\n     }\n   };\n \n   BrowserContextMenu.prototype._fetchElements = function bcm__fetchElements() {\n-\n     var id = this.CLASS_NAME + this.instanceID;\n     this.element = document.getElementById(id);\n-    this.contextFrame = document.getElementById(id + '-frame');\n-    this.elements = {};\n-\n-    var toCamelCase = function toCamelCase(str) {\n-      return str.replace(/\\-(.)/g, function replacer(str, p1) {\n-        return p1.toUpperCase();\n-      });\n-    };\n-\n-    this.elementClasses = ['header', 'list', 'list-frame'];\n-\n-    // Loop and add element with camel style name to Modal Dialog attribute.\n-    this.elementClasses.forEach(function createElementRef(name) {\n-      this.elements[toCamelCase(name)] =\n-        this.element.querySelector('.' + this.ELEMENT_PREFIX + name);\n-    }, this);\n+    this.modalDialog = new SmartModalDialog(this.element);\n+    // listen the event bubbled from modal dialog to determine the state\n+    this.element.addEventListener('modal-dialog-opened', this);\n+    this.element.addEventListener('modal-dialog-closed', this);","path":"tv_apps/smart-system/js/browser_context_menu.js","position":73,"original_position":73,"commit_id":"2c2567fed636cef43d8fd06c49d806d6a238d15c","original_commit_id":"2c2567fed636cef43d8fd06c49d806d6a238d15c","user":{"login":"rexboy7","id":2406290,"avatar_url":"https://avatars.githubusercontent.com/u/2406290?v=3","gravatar_id":"","url":"https://api.github.com/users/rexboy7","html_url":"https://github.com/rexboy7","followers_url":"https://api.github.com/users/rexboy7/followers","following_url":"https://api.github.com/users/rexboy7/following{/other_user}","gists_url":"https://api.github.com/users/rexboy7/gists{/gist_id}","starred_url":"https://api.github.com/users/rexboy7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rexboy7/subscriptions","organizations_url":"https://api.github.com/users/rexboy7/orgs","repos_url":"https://api.github.com/users/rexboy7/repos","events_url":"https://api.github.com/users/rexboy7/events{/privacy}","received_events_url":"https://api.github.com/users/rexboy7/received_events","type":"User","site_admin":false},"body":"Should we move them to `_registerElements()`?","created_at":"2015-05-19T04:12:07Z","updated_at":"2015-05-19T04:12:07Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/30116#discussion_r30568165","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/30568165"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/30116#discussion_r30568165"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116","id":35692750,"html_url":"https://github.com/mozilla-b2g/gaia/pull/30116","diff_url":"https://github.com/mozilla-b2g/gaia/pull/30116.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/30116.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30116","number":30116,"state":"open","locked":false,"title":"Bug 1164353 - migrate browser context menu to use smart-modal-dialog","user":{"login":"huchengtw-moz","id":4318454,"avatar_url":"https://avatars.githubusercontent.com/u/4318454?v=3","gravatar_id":"","url":"https://api.github.com/users/huchengtw-moz","html_url":"https://github.com/huchengtw-moz","followers_url":"https://api.github.com/users/huchengtw-moz/followers","following_url":"https://api.github.com/users/huchengtw-moz/following{/other_user}","gists_url":"https://api.github.com/users/huchengtw-moz/gists{/gist_id}","starred_url":"https://api.github.com/users/huchengtw-moz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huchengtw-moz/subscriptions","organizations_url":"https://api.github.com/users/huchengtw-moz/orgs","repos_url":"https://api.github.com/users/huchengtw-moz/repos","events_url":"https://api.github.com/users/huchengtw-moz/events{/privacy}","received_events_url":"https://api.github.com/users/huchengtw-moz/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-19T03:12:21Z","updated_at":"2015-05-19T04:12:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f63b25714de5c6a136d71a25ce8ee20bc5a8d26","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30116/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/2c2567fed636cef43d8fd06c49d806d6a238d15c","head":{"label":"huchengtw-moz:bug-1164353-browser-context-menu-smart-modal-dialog","ref":"bug-1164353-browser-context-menu-smart-modal-dialog","sha":"2c2567fed636cef43d8fd06c49d806d6a238d15c","user":{"login":"huchengtw-moz","id":4318454,"avatar_url":"https://avatars.githubusercontent.com/u/4318454?v=3","gravatar_id":"","url":"https://api.github.com/users/huchengtw-moz","html_url":"https://github.com/huchengtw-moz","followers_url":"https://api.github.com/users/huchengtw-moz/followers","following_url":"https://api.github.com/users/huchengtw-moz/following{/other_user}","gists_url":"https://api.github.com/users/huchengtw-moz/gists{/gist_id}","starred_url":"https://api.github.com/users/huchengtw-moz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huchengtw-moz/subscriptions","organizations_url":"https://api.github.com/users/huchengtw-moz/orgs","repos_url":"https://api.github.com/users/huchengtw-moz/repos","events_url":"https://api.github.com/users/huchengtw-moz/events{/privacy}","received_events_url":"https://api.github.com/users/huchengtw-moz/received_events","type":"User","site_admin":false},"repo":{"id":9827613,"name":"gaia","full_name":"huchengtw-moz/gaia","owner":{"login":"huchengtw-moz","id":4318454,"avatar_url":"https://avatars.githubusercontent.com/u/4318454?v=3","gravatar_id":"","url":"https://api.github.com/users/huchengtw-moz","html_url":"https://github.com/huchengtw-moz","followers_url":"https://api.github.com/users/huchengtw-moz/followers","following_url":"https://api.github.com/users/huchengtw-moz/following{/other_user}","gists_url":"https://api.github.com/users/huchengtw-moz/gists{/gist_id}","starred_url":"https://api.github.com/users/huchengtw-moz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huchengtw-moz/subscriptions","organizations_url":"https://api.github.com/users/huchengtw-moz/orgs","repos_url":"https://api.github.com/users/huchengtw-moz/repos","events_url":"https://api.github.com/users/huchengtw-moz/events{/privacy}","received_events_url":"https://api.github.com/users/huchengtw-moz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/huchengtw-moz/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see https://wiki.mozilla.org/Release_Management/B2G_Landing","fork":true,"url":"https://api.github.com/repos/huchengtw-moz/gaia","forks_url":"https://api.github.com/repos/huchengtw-moz/gaia/forks","keys_url":"https://api.github.com/repos/huchengtw-moz/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huchengtw-moz/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huchengtw-moz/gaia/teams","hooks_url":"https://api.github.com/repos/huchengtw-moz/gaia/hooks","issue_events_url":"https://api.github.com/repos/huchengtw-moz/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/huchengtw-moz/gaia/events","assignees_url":"https://api.github.com/repos/huchengtw-moz/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/huchengtw-moz/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/huchengtw-moz/gaia/tags","blobs_url":"https://api.github.com/repos/huchengtw-moz/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huchengtw-moz/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huchengtw-moz/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/huchengtw-moz/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huchengtw-moz/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/huchengtw-moz/gaia/languages","stargazers_url":"https://api.github.com/repos/huchengtw-moz/gaia/stargazers","contributors_url":"https://api.github.com/repos/huchengtw-moz/gaia/contributors","subscribers_url":"https://api.github.com/repos/huchengtw-moz/gaia/subscribers","subscription_url":"https://api.github.com/repos/huchengtw-moz/gaia/subscription","commits_url":"https://api.github.com/repos/huchengtw-moz/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/huchengtw-moz/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/huchengtw-moz/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/huchengtw-moz/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/huchengtw-moz/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/huchengtw-moz/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huchengtw-moz/gaia/merges","archive_url":"https://api.github.com/repos/huchengtw-moz/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huchengtw-moz/gaia/downloads","issues_url":"https://api.github.com/repos/huchengtw-moz/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/huchengtw-moz/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/huchengtw-moz/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/huchengtw-moz/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huchengtw-moz/gaia/labels{/name}","releases_url":"https://api.github.com/repos/huchengtw-moz/gaia/releases{/id}","created_at":"2013-05-03T03:03:37Z","updated_at":"2014-11-17T05:32:51Z","pushed_at":"2015-05-19T03:11:35Z","git_url":"git://github.com/huchengtw-moz/gaia.git","ssh_url":"git@github.com:huchengtw-moz/gaia.git","clone_url":"https://github.com/huchengtw-moz/gaia.git","svn_url":"https://github.com/huchengtw-moz/gaia","homepage":"https://wiki.mozilla.org/B2G","size":915169,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"1d533e6f1acc4008c000e50750f8dedf1d39027e","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-05-18T09:26:09Z","pushed_at":"2015-05-19T03:59:38Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1558503,"stargazers_count":1925,"watchers_count":1925,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2304,"mirror_url":null,"open_issues_count":977,"forks":2304,"open_issues":977,"watchers":1925,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/30116"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30116"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30116/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30116/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/2c2567fed636cef43d8fd06c49d806d6a238d15c"}}}}