is there any JavaScript event fired when we open page in a new tab, like cmd+click on macOS? I'm pretty sure there's no event for that, but I think it would be extremely useful.
Many Single Page Apps don't behave correctly when using that feature. They will open the content in a new tab, but also change the content on the current tab. That's because they handle click event. For what I am aware of, some frameworks implement additional checking if a key is pressed, but it's pretty lame to assume the shortcut. Would be really cool if either of those were implemented:
Additional data on click event, like: extra: "new_tab".
Separate event for opening page in new tab/window, which I guess would be best if not fired when we right-click and select the option from the dropdown.
What do you guys think? And where would you send a proposal for that?
I don't think you'd get much traction on this. The html specs deal with the DOM for a single page. Browser tabs are implemented individually by the browser vendor, and there are no set specs for browser tabs afaik. I believe you'd have to convince each browser vendor to add this functionality individually since there isn't any other place that I know of where this could be entered as a "standard" for browsers to follow, like you could with a HTML or generic JS spec. The tabs belong to the browsers UI, not part of the DOM.
I also think most would view it as a privacy concern if browser tabs knew what other tabs were doing, outside of a browser extension (and even then!)