{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/2812","labels_url":"https://api.github.com/repos/atom/electron/issues/2812/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/2812/comments","events_url":"https://api.github.com/repos/atom/electron/issues/2812/events","html_url":"https://github.com/atom/electron/issues/2812","id":106907070,"number":2812,"title":"Menu item `label` and `accelerator` should be optional when `role` is specified","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/atom/electron/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/atom/electron/labels/menu","name":"menu","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-17T03:46:27Z","updated_at":"2015-09-17T15:31:37Z","closed_at":null,"body":"To reduce boilerplate it would be useful if default values were used for `label` and `accelerator` if `role` were specified.\r\n\r\nSo instead of:\r\n\r\n```js\r\nvar template = [\r\n  {\r\n    label: 'Edit',\r\n    submenu: [\r\n      {\r\n        label: 'Undo',\r\n        accelerator: 'CmdOrCtrl+Z',\r\n        role: 'undo'\r\n      },\r\n      {\r\n        label: 'Redo',\r\n        accelerator: 'Shift+CmdOrCtrl+Z',\r\n        role: 'redo'\r\n      }\r\n    ]\r\n  }\r\n];\r\n```\r\n\r\nI could just do:\r\n\r\n```js\r\nvar template = [\r\n  {\r\n    label: 'Edit',\r\n    submenu: [\r\n      {\r\n        role: 'undo'\r\n      },\r\n      {\r\n        role: 'redo'\r\n      }\r\n    ]\r\n  }\r\n];\r\n```\r\n\r\n-\r\n\r\n`submenu` should also be optional. Would be useful for the `services` role.\r\n\r\n-\r\n\r\nThis would also have the benefit of those menu items being automatically localized for you."},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/141123359","html_url":"https://github.com/atom/electron/issues/2812#issuecomment-141123359","issue_url":"https://api.github.com/repos/atom/electron/issues/2812","id":141123359,"user":{"login":"zcbenz","id":639601,"avatar_url":"https://avatars.githubusercontent.com/u/639601?v=3","gravatar_id":"","url":"https://api.github.com/users/zcbenz","html_url":"https://github.com/zcbenz","followers_url":"https://api.github.com/users/zcbenz/followers","following_url":"https://api.github.com/users/zcbenz/following{/other_user}","gists_url":"https://api.github.com/users/zcbenz/gists{/gist_id}","starred_url":"https://api.github.com/users/zcbenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcbenz/subscriptions","organizations_url":"https://api.github.com/users/zcbenz/orgs","repos_url":"https://api.github.com/users/zcbenz/repos","events_url":"https://api.github.com/users/zcbenz/events{/privacy}","received_events_url":"https://api.github.com/users/zcbenz/received_events","type":"User","site_admin":true},"created_at":"2015-09-17T15:31:37Z","updated_at":"2015-09-17T15:31:37Z","body":"I'm :+1: on this, the major problem is the localization of the labels, we can probably copy and use the resources from Chromium."}}