diff --git a/atom/browser/api/event_emitter.cc b/atom/browser/api/event_emitter.cc index b3cdb21d1302..abd297fad653 100644 --- a/atom/browser/api/event_emitter.cc +++ b/atom/browser/api/event_emitter.cc @@ -79,6 +79,7 @@ v8::Local CreateEventFromFlags(v8::Isolate* isolate, int flags) { obj.Set("ctrlKey", static_cast(flags & ui::EF_CONTROL_DOWN)); obj.Set("altKey", static_cast(flags & ui::EF_ALT_DOWN)); obj.Set("metaKey", static_cast(flags & ui::EF_COMMAND_DOWN)); + obj.Set("triggeredByAccelerator", static_cast(flags)); return obj.GetHandle(); } diff --git a/docs/api/structures/keyboard-event.md b/docs/api/structures/keyboard-event.md index f8b463fd38c4..95442ee0e574 100644 --- a/docs/api/structures/keyboard-event.md +++ b/docs/api/structures/keyboard-event.md @@ -4,3 +4,4 @@ * `metaKey` Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event * `shiftKey` Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event * `altKey` Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event +* `triggeredByAccelerator` Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index b7a7ce80b369..04e3b173a95d 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -31,7 +31,7 @@ const delegate = { command.click(event, TopLevelWindow.getFocusedWindow(), webContents.getFocusedWebContents()) }, menuWillShow: (menu) => { - // Ensure radio groups have at least one menu item seleted + // Ensure radio groups have at least one menu item selected for (const id in menu.groupsMap) { const found = menu.groupsMap[id].find(item => item.checked) || null if (!found) v8Util.setHiddenValue(menu.groupsMap[id][0], 'checked', true)