I only recently found out about "oncontextmenu", which is a javascript event that fires when a user right clicks a web page. Using that event, you can prevent the OS/browser right click menu, and even create your own menu.<p>So my question is: why don't more web apps make use of that? A right click is an operation that's instilled in many (all?) computer users, why not leverage that instead of having complicated dropdown options menus?
One problem is usually you have to disable the built-in menu. The built-in menu does some pretty important things and as an end user I basically never want it disabled.
Thank god they don't. I hate it when I try to right click to do something and I get some custom control with like one or two options I don't even want.
Oftentimes, web users are already habituated to the use of default right-click context menus in browsers, at least for most web pages. Oncontextmenu is certainly great for some applications, which is why it's there, but it can damage usability if it's abused.<p>Whenever I visit a site with right-click events, I think back to the early days of the web, when webmasters tried to prevent you from viewing their source by capturing right-clicks (then you just had to use the menu bar).
It's been in use since the 90's people would attach the event to images, and assert copyright in an alert dialog on the event callback:<p><pre><code> Array.prototype.forEach.call(document.getElementsByTagName('img'), function(value) {
value.oncontextmenu = function() {
alert("Get off my lawn!");
}
});</code></pre>
It is bad form to block default UI,and it will only annoy and anger your users. The solution to this is to append your own menu to the default context menu. However, this cannot be done AFAIK. Probably a standard that allows that would be something worthy of consideration. So the only way to deal with this is custom UI elements. (As a Windows desktop developer moving to web development, I was quite dismayed that I couldn't simply get menu handle and append. In general, moving to straight jacketed webapps from desktop background where almost everything was possible was quite frustrating and painful.)
You answered your own question, 'I only recently found out about "oncontextmenu"', not a lot of people (outside of tech) seem to know about it, also not everyone uses a mouse!
UI needs to be predictable and discoverable, right click on web pages is neither. People in general either don't use right click, or expect the browser context menu to show up. So if you hide important UI controls behind right click, many users won't find them.
I believe it's a cycle: Web developers don't make use of right-clicking, so users don't expect to use it and never try, so web developers don't use because it's not discoverable, and so on.
We make use of right-clicks EXTENSIVELY, almost any and everything in TaskPutty.com is clickable.<p>Of course our app is designed to make every single widget or thing user modifiable and configurable.