Webview + Keyboard Shortcut Management + Focus

Hey all, just wondering if someone can help me out here.

I have a juce application that uses a single applicationcommandtarget to handle all keyboard shortcuts. Within this application, we handle traditional shortcuts like cmd+c for copy, and cmd+v for paste.

We’re now introducing a webview component, and when attempting to use any shortcut that’s registered with the old applicationcommandtarget, it will instead be handled via that.

I can think of a few things I would like to do to solve this, but most of them require knowledge of when the webview component has focus.

Though the (choc) webview component is wrapped inside a juce::Component, clicking inside the webview causes the juce component focus to just act as if I clicked outside the application, as the focused component becomes null.

Is there any recommended way to approach this issue?

So for additional context here, what happens is:

Webview is clicked. It’s components are focused by the system (Voiceover on MacOS correctly handles the focus here), but according to the juce application, the currently focused component is nullptr. This makes sense as these components aren’t actually juce::Components?

When currentlyFocusedComponent is nullptr, getTarget returns the componentPeer’s component (in this case, the Window of my application) as the target for keypress, and then the keypress is forwarded to the application command manager’s keypress set.

Is there any way to differenciate between if the webview has focus and that is why the focused component is nullptr, vs a legitimate case of no focused component in my application?