Control-click on Mac not triggering JPopupMenu
On Mac, the popup menus in my app do not invoke with the usual control key+left click combo. (If you press the "Juggle" button, in the animation window that pops up there is a JPopupMenu in the area to the right.) A workaround is to use a two-button mouse, or enable "secondary click" in trackpad preferences. Still, this isn't an ideal user experience since the control+left click combo is supported by popular web apps (Google Drive for example), and all regular Mac applications (including Java ones).
I confirmed that java.awt.event.MouseEvent.isPopupTrigger() always returns false for the control+click combo on the Mac when running in CheerpJ, in both Chrome and Safari.
We will consider fixing this the next time we iterate on mouse handling code, thanks for reporting this.
:thumbsup: Update: I discovered that control+left click does work correctly in Firefox. So this issue is specific to Chrome and Safari.
This issue is still present in CheerpJ 3.0.
Seems this is a result of the following MouseEvent.ctrlKey behaviour on macOS:
a click combined with the control key is intercepted by the operating system and used to open a context menu, so ctrlKey is not detectable on click events. source: MDN
- On Chrome, ctrl+leftclick does not bring up the popup menu (incorrect)
- On Firefore, ctrl+leftclick does bring up the popup menu (correct)
- Regardless of browser, rightclick brings up the popup menu (correct)
e.isPopupTrigger()appears to always betrue(not sure if correct)
I think the reason for this difference is that the behaviour described on MDN doesn't seem to apply to Firefox. Here's a JSFiddle test; on Chrome ctrl+leftclick gives ctrlKey: false but on Firefox ctrl+leftclick gives ctrlKey: true!