Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control-click on Mac not triggering JPopupMenu #80

Open
jkboyce opened this issue Apr 7, 2020 · 3 comments
Open

Control-click on Mac not triggering JPopupMenu #80

jkboyce opened this issue Apr 7, 2020 · 3 comments
Labels
bug chrome Issue specific to Chrome/Chromium/derivatives macos Issue specific to macOS

Comments

@jkboyce
Copy link

jkboyce commented Apr 7, 2020

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.

@alexp-sssup
Copy link
Member

We will consider fixing this the next time we iterate on mouse handling code, thanks for reporting this.

@jkboyce
Copy link
Author

jkboyce commented Apr 10, 2020

👍 Update: I discovered that control+left click does work correctly in Firefox. So this issue is specific to Chrome and Safari.

@bates64 bates64 assigned bates64 and unassigned bates64 Jan 22, 2024
@bates64
Copy link
Contributor

bates64 commented Jan 26, 2024

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

JSFiddle reproduction:

  • 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 be true (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!

@bates64 bates64 added bug chrome Issue specific to Chrome/Chromium/derivatives macos Issue specific to macOS labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug chrome Issue specific to Chrome/Chromium/derivatives macos Issue specific to macOS
Projects
None yet
Development

No branches or pull requests

3 participants