-
Notifications
You must be signed in to change notification settings - Fork 155
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
Difference between Mac and Windows in how focus is handled #320
Comments
Mouse clicks outside of the browser are handled somewhat differently on macOS and Windows. On macOS the events are sent to the superview via NSApplication.load in native code. On Windows the events are passed to onMouseEvent in Java code. Perhaps we should use the Java code path on both platforms. |
The attached mac_mouse.patch converts util_mac.mm to use the same mouse handling code path as Windows (via the onMouseEvent method in Java). However, that doesn't resolve the reported focus issue. |
|
Below is the callstack for [RenderWidgetHostViewCocoa resignFirstResponder] when clicking outside of the browser window. It looks AWTWindow_Normal in the JVM implementation is becoming first responder, which removes focus from the browser window. I'm not sure what, if anything, we could do to fix this from JCEF code.
|
Original comment by Klemen Pevec (Bitbucket: Klemen Pevec). I am not sure if this is related, but I have a case where I put multiple CefBrowser UI components in Swing Tabbed Pane and only the last CefBrowser added to the tabs responds to mouse events. This only happens on Mac, Windows is unaffected by this. JCEF is not running in OSR mode. |
Original report by Jonathan Kwang (Bitbucket: jonathankwangMW).
There seems to be a difference with how jcef handles mouse clicks between the Windows and Mac environments. The issue is specifically on a Mac where if there is a mouse click that occurs outside of the browser window, the browser loses focus even if focus was not transferred to any other element in the UI.
This can be reproduced in the test app by adding a unfocusable JLabel to the content pane of MainFrame.java in place of the ControlPanel of the detailed app. (I've attached a modified MainFrame.java file which does this) When running the app, on Windows clicking on the JLabel will keep focus in the browser window (i.e you can still type into the google search box) and on a Mac clicking on the JLabel causes the browser to lose focus and you need to manually click into the browser window to type into the google search box.
The text was updated successfully, but these errors were encountered: