I have added mouse-click actions (Go to URLs, mostly) which get triggered even on right mouse clicks.
Is there a way for the user to open the links in a new tab if they wish to? As far as I know, right click > open link in new tab won’t work for JS based links and they work only for HTML anchor tags, but, just confirming.
Basically correct. Users can command-click on links and the Go to URL has an option to open in a new window which for all intents and purposes is a new tab nowadays.
Other than that, if you want to have the context menu behave like a link, you will need to embed a <a href="http://example.com"></a> tag within Inner HTML.
Ah, gotchya. Yet my testing does not have this behavior and your site doesn’t look like it is loading properly right now.
When I do a two-finger click on my macbook pro trackpad to invoke the context menu, it shows up and the Go to URL action is not triggered. I’m running macOS 10.14 and testing against the latest Safari and Chrome.
How are you triggering a right click? What browser/OS and version are you using? What mouse are you using? Do you have a more reduced case in a .hype document you can send?
I’m trying it on my Windows 10 Pro 1903 laptop in Google Chrome Canary 76 (in Guest account i.e., free from any cache, cookies and extensions - almost like incognito). I’m using an external 3-button mouse, even though, the right click on my trackpad is also doing the same thing. It does load the context menu, but, also triggers the Go to URL. This is happening on the entire website.
Here’s a short screen recording of what’s happening:
Also, I tried this on my mac on which I’m developing, so, yeah, the context menu does load, but, sometimes, the Go to URL is getting triggered on multiple right-clicks. One pattern I noticed that, on first right-click, only the contect menu loads and if we right-click again without dismissing the context menu, the Go to URL is triggered. While, if we dismiss the context menu and right click, the menu loads again. Here’s a video of that:
Here’s the .hype document (zipped), with just the Home scene:
Thanks - it looks like while we check to avoid running actions on a mousedown event, mouseups (which would seem unlikely but can happen in situations like the mac+chrome one) and pointerup (for windows) wasn’t filtering this out. I’ve made a fix for the next version after 4.0.0.
In the mean time if this is a high priority issue to avoid, the workaround would be to use a run javascript action and use a check to determine if a right/control click was used instead of the Go to URL action. It’d be something like:
if(event.ctrlKey == true || event.button != 0) {
return;
}
// do action you want
location.href = "http://example.com";