
Ask HN: Why don't web apps make use of right click? - catskull
I only recently found out about &quot;oncontextmenu&quot;, which is a javascript event that fires when a user right clicks a web page. Using that event, you can prevent the OS&#x2F;browser right click menu, and even create your own menu.<p>So my question is: why don&#x27;t more web apps make use of that? A right click is an operation that&#x27;s instilled in many (all?) computer users, why not leverage that instead of having complicated dropdown options menus?
======
yakult
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.

~~~
csmattryder
I completely 100% agree, but it'd be nice to be able to append to a small sub-
group "Webpage Settings" that'd allow you to drop a few additional items in
the menu.

I think we're at this point, especially with mobile getting analogue touch
sensitivity via "Force Touch" on iOS.

Of course, to prevent overzealous developers, the title strings must not share
the same name one of the existing static items. Let's learn from letting our
less wise colleagues alter scroll behaviour.

------
garyadamshannon
Answer: How do you right click on a phone?

A proportion of people are designing mobile first, desktop displays are second
priority.

~~~
Avalaxy
The touch equivalent of a right click is a long press.

~~~
Garvey
Can't it also be a two finger tap?

------
wingerlang
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.

------
robgibbons
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.

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).

------
_RPM
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:

    
    
        Array.prototype.forEach.call(document.getElementsByTagName('img'), function(value) { 
            value.oncontextmenu = function() { 
                alert("Get off my lawn!"); 
            }
        });

~~~
mod
They used to do it on mousedown, so then you could hold the mouse down, click
enter to dismiss the alert, and then release the mouse, and get the menu
anyway.

The internet used to suck a lot worse than it does now.

------
p333347
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.)

~~~
jklein11
It looks like you can extend the context menu of chrome[1], safari[2], IE[3],
and firefox[4].

1.[https://developer.chrome.com/extensions/contextMenus](https://developer.chrome.com/extensions/contextMenus)
2.[https://developer.apple.com/library/content/documentation/To...](https://developer.apple.com/library/content/documentation/Tools/Conceptual/SafariExtensionGuide/AddingContextualMenuItems/AddingContextualMenuItems.html)
3.[https://msdn.microsoft.com/en-
us/library/aa753589(v=vs.85).a...](https://msdn.microsoft.com/en-
us/library/aa753589\(v=vs.85\).aspx) 4.[https://developer.mozilla.org/en-
US/Add-ons/SDK/Tutorials/Ad...](https://developer.mozilla.org/en-US/Add-
ons/SDK/Tutorials/Add_a_Context_Menu_Item)

~~~
p333347
Yes but I was talking about a standard that doesn't depend on idiosyncrasies
of different browsers and their ecosystems.

------
Cozumel
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!

------
raquo
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.

------
csallen
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.

------
andriesm
We make use of right-clicks EXTENSIVELY, almost any and everything in
TaskPutty.com is clickable.

Of course our app is designed to make every single widget or thing user
modifiable and configurable.

------
marpstar
1\. It's extra work that only "power users" will benefit from. 2\. No support
on mobile?

------
_RPM
Google Drive makes use of `oncontextmenu` and also Outlook does too.

