GNOME Shell consistently loses/blocks mouse clicks in an application window
This is happening for Ubuntu 18.04.2 LTS (bionic) in the default desktop environment (Ubuntu). It also happens for the GNOME and GNOME Classic desktop environments. The version of gnome-shell is 3.28.3-0ubuntu0.18.04.4. A lesser form of the bug still occurs in Ubuntu 18.10 for gnome-shell version 3.30.1-2ubuntu1.18.10.2.
Our program is a blend of C# winforms (Mono) with embedded web browser windows using Geckofx45 (mozilla version 45). Editing windows in the program use HTML to display formatting and typescript/javascript code to assist with popup dialogs and other editing help.
For gnome-shell 3.28.3 on Ubuntu 18.04, left mouse clicks are essentially ignored inside these editing windows. Keyboarding still works fine as far as I can tell. Clicking on the gear button inside the editing window fails to bring up the Format dialog more than 95% of the time. When the dialog does display, it is always (100%) nonfunctional as the first click in it causes it to close immediately. For gnome-shell 3.30.1 on Ubuntu 18.10, the left mouse clicks work fine to relocate the editing selection point and to bring up the Format dialog. But the first click in the dialog still closes it without allowing the user to actually do anything.
Tracing the internal behavior of the code (when using gnome-shell 3.28.3), it appears that clicking the first time inside the editing (browser) window causes a series of WM_FOCUS messages to be sent and the javascript to hook up a left mouse click handler to a gear button displayed in the lower left corner of the editing window. This is the expected behavior, and the same as on other window managers. But then, on GNOME Shell only, a series of WM_KILLFOCUS messages are sent immediately. This does not happen for other window managers. (The main window receives a WM_ACTIVATE message with the argument to make it deactivate.) Any other left mouse clicks inside that window are ignored >95% of the time, probably only when double clicking quickly enough to occur before those messages to lose focus/deactivate are handled. (Right mouse clicks are handled at a higher level and appear to function normally.)
The program in question is called Bloom. The source code is available at https://github.com/BloomBooks/BloomDesktop and prebuilt debian/ubuntu packages are available at http://packages.sil.org/ubuntu/ as bloom-desktop or bloom-desktop-beta for bionic (Ubuntu 18.04). After spending a few days looking at this problem, I've reluctantly come to the conclusion that it must be a GNOME Shell bug that I can't work around in our code. It's working fine in Microsoft Windows and all the other Linux window managers that I've tested (Unity, Cinnamon, KDE Plasma, MATE, XFCE, and LXDE). I've attached a screenshot showing the Format dialog open. (The screenshot was taken under Cinnamon on Ubuntu 18.04, but shows the dialog in question that is still not working for GNOME Shell under Ubuntu 18.10 even though it displays.)