From b71a5a5955520fac7c54141f975a6c226cd1cb1e Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 7 Jan 2019 16:01:03 -0800 Subject: [PATCH] fix: register accelerator if role has no registerAccelerator (#16309) * fix: register accelerator if role has no registerAccelerator * ensure roles[role].registerAccelerator is defined --- lib/browser/api/menu-item-roles.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/browser/api/menu-item-roles.js b/lib/browser/api/menu-item-roles.js index a3075a99ffd8..9162bc1e6896 100644 --- a/lib/browser/api/menu-item-roles.js +++ b/lib/browser/api/menu-item-roles.js @@ -254,7 +254,8 @@ exports.getDefaultAccelerator = (role) => { } exports.shouldRegisterAccelerator = (role) => { - return roles.hasOwnProperty(role) ? roles[role].registerAccelerator : true + const hasRoleRegister = roles.hasOwnProperty(role) && roles[role].registerAccelerator !== undefined + return hasRoleRegister ? roles[role].registerAccelerator : true } exports.getDefaultSubmenu = (role) => {