All shortcut will invalid after WebBrowserComponent gained focus


#1

All shortcut made from ApplicationCommandManager and ApplicationCommandTarget.

Tested in JUCE-Demo (Windows platform), it also has this problem. For example: ‘ctrl + -’ and ‘ctrl + =’ will switch to previous/next ‘demo-page’ normally, but when switch to the WebBrowser and click on this page which displaying juce.com, ‘cmd + -’ and ‘cmd + =’ will invalid…

It seems the WebBrowserComponent hasn’t received any keypress. I wrote a class derived from WebBrowserComponent, overwrite keyPressed() and focusGained() and put 2 break-point in them, but they never be hit.


#2

Any help?


#3

I think this might be difficult to work around - it looks like the native web browser is consuming those key presses, so there’s no way for them to reach the rest of the application.


#4

Thanks Tom.

Does JUCE team have a plan to solve this problem?


#5

This kind of makes the browser component fairly unusable. I guess many people might have used it to launch html help files within their application. When one does you no longer have access to your keyboard shortcuts after their help files show. Surely there must be some kind of workaround for this?


#6

Yes, I agree with “fairly unusable”.
The keyboard focus, once in the webbrowser, will never go back to the JUCE window.
You can see this also in the juce webbrowser demo.

To reproduce:
As long as you do not click on the webbrowser, you can edit the text in the address bar, which is initially “https://www.juce.com/”.
Click in the browser and click then in addressTextBox again.
Try to edit the URL…

This is really a pity, because the webbrowser could be used to implement features known from other frameworks but missing in JUCE.
In another framework with embedded browser window I have something useful around codemirror, which I unfortunately can not use in JUCE…
https://codemirror.net/demo/fullscreen.html

I am on Windows 7, 64bit.
I would be interested about Linux and OSX behavior with there own platform implementation.
Is this only an issue on Windows?

I would be more than happy if someone finds a solution to get the keyboard focus back from the browser control. This is JUCE specific, but if this JUCE problem is solved and the webbrowser starts to get usable, I can contribute to the browser component itself (on Windows) with getting rid of the script errors message and more useful functions,e,g. printing and what else.


#7

I can’t recall if this is Windows only. I fear it may be as it took me some time to spot the issue. I would love to be able to embed the CodeMirror text editor into my application, or any other JS editors. If you somehow find a way to make this work please let us know.


#8

Hi Rory,
I do not think, that I would get the webbrowser component in JUCE to behave better in a few days.
My app project with CodeMirror is not audio related, so I am not locked into JUCE, although I would love to use JUCE for it.
If using JUCE I will have to integrate WebSocket communication (I already used CivetWeb for browser communication) to communicate to CodeMirror, similary like Adobe is using WebSockets in their Brackets editor to deal with CodeMirrors document model.
If I get the feeling that the better integration of the webbrowser component has no focus at Roli I will head over to Qt for this project (and have to fight QAbstractItemModel instead of using ValueTree :roll_eyes:).