-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mac: Keyboard shortcuts and menu bar item for Find don't work #3462
Comments
Related commentary from chrome/browser/global_keyboard_shortcuts_mac.h CommandForKeyEvent:
So, this issue is likely related to the menu bar items being disabled. |
Chrome builds the menu bar in chrome/browser/ui/cocoa/main_menu_builder.mm [1] whereas CEF sample apps use MainMenu.xib. Some commands (like cut/copy/paste here) are handled by Chromium's render_widget_host_view_cocoa.h, which is the view that lives in the Cocoa view hierarchy. Other commands (like find) might need to be enabled/handled in CEF's ClientAppDelegate, in which case we would be blocked by #3282. Looking at the find menu created by Chrome's main_menu_builder.mm, some items simply map to a command ID (like IDC_FIND) which is then passed to commandDispatch in Chrome's app_controller_mac.mm [2], while others are directly forwarded to selectors implemented by Chromium's render_widget_host_view_cocoa.mm (like copyToFindPboard). Enabled/disabled status for these items is handled via validateUserInterfaceItem (in render_widget_host_view_cocoa.mm if there's a browser, app_controller_mac.mm otherwise). [1] CEF disables the call to chrome::BuildMainMenu in ChromeBrowserMainPartsMac::PreCreateMainMessageLoop via chrome_runtime.patch. [2] There's also some fancy logic to route handling of items using commandDispatch. |
This is also an issue with cefsimple |
Some commands are handled via hotkeys, see https://chromium.googlesource.com/chromium/src/+/main/docs/mac/about_hotkeys_and_keycodes.md |
Testing with ⌘C Results in a call to validateUserInterfaceItem. When browser view is focused:
When URL bar text area is focused:
Call stack to chrome_render_widget_host_view_mac_delegate.mm validateUserInterfaceItem:
Testing with ⌘F Does not result in a call to validateUserInterfaceItem. When browser view is focused:
When URL bar text area is focused:
|
This might be because the Find command does not have a valid target in MainMenu.xib (e.g. performFindPanelAction does not exist) (details). |
This looks like the way forward. We can then configure the correct target in MainMenu.xib and forward the commands to Chrome. |
Changing the "Find" portion of MainMenu.xib for cefclient to:
The
The
It looks like BrowserFrameMac::OnWindowInitialized is not being called, so For
|
After fixing that, the
We can implement the various BrowserFrameMac (views::NativeWidgetMac) callbacks in CefNativeWidgetMac. |
Testing these changes it looks like the Find Bar can still be triggered (even in Google Chrome) while showing a window-modal dialog. Filed as https://bugs.chromium.org/p/chromium/issues/detail?id=1434768. |
Original report by me.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
For Cmd-F the “Find” widget should display. Instead, nothing happens.
What version of the product are you using? On what operating system?
M112 on macOS 13.2.1 (22D68).
Additional related notes:
The text was updated successfully, but these errors were encountered: