Merge pull request #6370 from electron/send-key-event-to-main-menu

Give menu a chance to handle keydown event before window
This commit is contained in:
Cheng Zhao 2016-07-07 10:11:12 +09:00 committed by GitHub
commit c7e0df09bc

View file

@ -27,6 +27,11 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
ExitFullscreenModeForTab(source);
// Send the event to the menu before sending it to the window
if (event.os_event.type == NSKeyDown &&
[[NSApp mainMenu] performKeyEquivalent:event.os_event])
return;
if (event.os_event.window)
[event.os_event.window redispatchKeyEvent:event.os_event];
}