While many people might have another keyboard hooked up to their computer, that wasn't the case for me. You can be sure by disabling bluetooth (if your main keyboard is wired).
Other problems I've researched include: specific websites mess with CMD+Click via javascript either intentionally or accidentally. To debug, try a few different websites. If it's just one website that you really want CMD+Click to work on, there are some chrome extensions you can try, I haven't used any of them.
Make sure your CMD key works correctly. The OP in this thread did this via using CMD+0 or CMD+1 to navigate to different tabs.
Not sure what my issue was, but restarting the OS fixed it. Give that a try. Good luck.
Answer from Schneems on Stack ExchangeWhile many people might have another keyboard hooked up to their computer, that wasn't the case for me. You can be sure by disabling bluetooth (if your main keyboard is wired).
Other problems I've researched include: specific websites mess with CMD+Click via javascript either intentionally or accidentally. To debug, try a few different websites. If it's just one website that you really want CMD+Click to work on, there are some chrome extensions you can try, I haven't used any of them.
Make sure your CMD key works correctly. The OP in this thread did this via using CMD+0 or CMD+1 to navigate to different tabs.
Not sure what my issue was, but restarting the OS fixed it. Give that a try. Good luck.
As @apennebaker commented. The issue ended up being a bluetooth keyboard in a backpack.
Ah, "the old" backpack and keyboard problem.
Obviously not everything is better with bluetooth.
Please check your bluetooth and make sure that is not the cause of your problems when troubleshooting keyboard issues.
Speculating here, but will confirm later from a Mac. This has been confirmed to be working on a Mac.
Win ctrl+click or a Mac command+click gets picked up by a "normal" click listener, just like a click with any other modifier key (alt+click, shift+click etc).
This is particularly confusing since a ctrl+click on a Mac gets interpreted as a right-click on OS level. Command-click, on the other hand, is not interpreted as a middle-click but rather is a browser preference.
Assuming that you do not have in-site functionality that specifically relies on modified clicks, it would be appropriate to exclude such events from click listeners, and instead allow for them to bubble up to be natively handled by the browser. Given the experience of someone in the similar situation, you should be able to add the following to click handlers (likely a delegate on library level as pointed out by Brilliand):
if (e.metaKey || e.ctrlKey) return;
When added at the beginning of the handler with e referring to a current click event, this should circumvent any following e.preventDefault();
Update:
It actually works! In this rather minimalistic fiddle, I am able to recognize when command-clicked or control-clicked, so as to avoid executing the rest of the click handler which includes ajax-fetching the content and e.preventDefault();. This allows for a command-click to be handled "as intended" on a Mac, i.e. opening the link in a new tab.
With this finding in mind, these lines should now read
if (e.isDefaultPrevented() || e.metaKey || e.ctrlKey) {
return;
}
There is some interesting insight here: https://groups.google.com/forum/#!msg/mozilla.dev.usability/H1qLTur4EFc/gXH007CAPk8J
Apparently the JS you are using can preventDefault() the cmd+click while the middle-click is unaffected. Consult the docs of your JS/Site framework.
Why does cmd + click not open in a new tab on some sites?
CMD Click (to open a new tab) sometimes only works after 3 uses - Google Chrome Community
Command-click not opening new tab in Safa… - Apple Community
CMD + click to open in new tab - not working in quoted posts / topic oneboxes - Bug - Discourse Meta
I sometimes come across sites where hitting cmd + click does not open the link in a new tab. Is this intentional or just a side effect of a way they've built the site?
It happens on this site: https://www.amartfurniture.com.au/dining-room/sets/6-seater-sets
It's so annoying. Right click and open in new tab works, but I'm in a habbit of using cmd.
JavaScript behind the scenes
This happens when developers of such web pages intercept mouse clicks with JavaScript and do asynchronous network requests inside the interceptor, potentially to track your clicks. When the async network call returns, the JS does a programmatic redirect using something like: window.location.href = url;
This programmatic redirect will always load the page in the same tab, even if you hold Ctrl (Cmd on Mac).
Use MiddleMouse to override
Clicking middle button on your mouse or selecting 'open in a new tab' from the context menu will bypass the intercepting JavaScript code entirely and will open a link as if there were no JavaScript code at all.
I wrote a Firefox add-on (boringly) named link-fixer to fix this. You can install from addons.mozilla.org. It requires Firefox 48.0 or later.
Quoting myself:
The default behaviour of ctrl+click, shift+click and cmd+click when clicking on links is to open the link in a new tab or new window. This behaviour is sometimes broken by careless developers. This add-on restores the default behaviour, ensuring the modifer keys are always respected.
Once installed there's nothing else you need to do. You can ctrl+click on any link and it will open in a new tab. It'll also solve the variation of the problem you describe in your second paragraph.
It is because of JavaScript that captures your clicks and, because of that, interferes with your keyboard shortcuts. If you disable JavaScript then shortcuts should start to work again. You can test it by pressing CTRL+SHIFT+I (Developer tools), then clicking Settings (gear icon) and enabling option Disable JavaScript.
Middle-clicking seems to work like a ctrl-click (as mentioned by Firelord in the comments).