Multiple major keyboard focus issues on Linux (branches 2883, 2840, 2785)

Issue #2026 new
Czarek Tomczak
created an issue
  1. [cefclient] Branch 2883 regression. Type something in address bar and click on the browser widget and try to type - keyboard doesn't work in browser. This worked fine in branch 2840 and stopped working in branch 2883.

  2. [cefclient] Branches 2883, 2840, 2785. Click on address bar - a type cursor indicator is missing. There should be a vertical cursor blinking indicating at which position in text I'm typing. Looks to me CEF browser never releases focus entirely - a proof for that seems to be the focus bug in Issue 4) [third party] - CEF steals keyboard focus from native widget when just hovering over CEF browser (no click).

  3. [third party: wxWidgets, Tkinter] Branches 2785, 2840 and 2883. When using third party GUI frameworks like wxWidgets and Tkinter, native widgets can't take keyboard focus. There was a workaround found by calling gtk_window_present(1), but it still doesn't resolve the issue entirely. Keyboard focus on a native widget works only when mouse is over the native widget. When native widget has keyboard focus and I move mouse cursor to CEF browser widget (just hover, no click), then native widget loses keyboard focus, and neither CEF browser and nor native widget have keyboard focus at that time. More details reported in this topic on the CEF Forum: https://magpcss.org/ceforum/viewtopic.php?f=6&t=14568

  4. [third party: Tkinter]. Branch 2883 regression - this focus bug doesn't occur in branch 2840. When native widget has keyboard focus and I move mouse out of that widget and hover of CEF browser widget then CEF steals keyboard focus automatically. I don't click on CEF browser, only hover with mouse over it. When I move mouse back over native widget, then CEF browser still has keyboard focus. This might be related to Issue 2) [cefclient] and Issue 3) [third party] - looks like native widget never has focus entirely.

  5. [third party: PyGTK] Branch 2883. Issue with gtk2.py example in CEF Python. It is a very basic GTK example that has a menu and a VBox widget in which CEF browser is embedded. I'm launching example and CEF browser is loading, when I start clicking with a mouse inside widget and/or typing, while it loads, then later keyboard doesn't work. The CEF browser has focus, I can select text with mouse, I can click on google search input and a blinking type cursor indicator appears, but I can't type anything. I tried to reproduce this issue in my other cefpython examples (hello world, tkinter) and in cefclient/cefsimple, but the issue doesn't occur there. Looks like this focus issue is specific to that GTK / VBox layout in that gtk2.py example. If I don't do any clicks/typing during loading then the issue doesn't occur.

Testing on Ubuntu 14.04 64-bit with latest CEF commits in branches 2883, 2840 and 2785.

Comments (9)

  1. Marshall Greenblatt

    If someone wants to debug this the likely places to start are libcef/browser/native/window_x11.cc in CEF and ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc in Chromium.

    See also issue #1679 and issue #1417 for previous attempts to fix focus-related issues on Linux.

  2. Czarek Tomczak reporter

    I haven't yet had time to debug this further. I managed to find simple workarounds in most of examples in cefpython (by calling setfocus in OnLoadStart once on initial loading and in CefFocusHandler.OnGotFocus).

    However the focus issues seem to occur also on Mac and the same fixes that worked on Linux, don't work on Mac. So far I've been testing CEF with Qt toolkit on Mac and CEF is always eating keyboard focus from other controls. I see that cefclient on Mac doesn't have a navigation bar, so seems like CEF on Mac has no tests for how it behaves with other controls.

  3. Czarek Tomczak reporter

    cefclient Issue 1) described in first post combined with a Javascript Alert which occurs on pages which log messages (the alert notifies about messages being written to console.log) makes it impossible to use cefclient on some pages. Here are the steps to reproduce:

    1. Load url https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB

    2. At the end of that page, just above the "Reference" section click the "Test the online live demo" link

    3. The new page loads and you can see javascript alert. After closing that alert browser becomes broken - you can't type anything in the form on the page.

  4. Vagabundo1234

    I'm having this issue on windows with CEFpython3 (version 57.0) with Tk.

    If the CEF window grabs the keyboard my app cant get it back unless I cwicth to another application window and then back to my tk app again. Then I can use keyboard for tk widgets, until the CEF window grabs the keyboard again.

  5. Czarek Tomczak reporter
  6. Log in to comment