[whatwg] <menu> and friends

Justin Dolske dolske at mozilla.com
Sat Jan 5 00:05:29 PST 2013


On 1/4/13 7:05 PM, L. David Baron wrote:

>> I feel that I do see this quite often. maps.google.com, Google docs,
>> and Zimbra are three examples off the top of my head that I spend a
>> lot of time with.
>
> Has anyone asked the authors of these sites if they would have liked
> to retain the browser's default context menu items if they had been
> able to do so (while simultaneously adding their own items)?

It's certainly an interesting dichotomy.

If you look at it from the PoV of a traditional browser-UI-implementer, 
it's an unsettling prospect... Allowing sites to override the context 
menu leads to undesirable user surprise ("Hey, where'd my content menu 
stuff go?!"). And in the past(?) a significant amount of oncontextmenu 
usage was used solely for sketchy copy-protection purposes (ie, 
attempting to block "copy selected text" or "copy image location" or 
"view source").

If you look at it from the PoV of a modern "webapp" (whatever that 
means), many of the browser's standard context menu entries are simply 
not terribly relevant to the webapp-specific uses a user might be 
expecting. Consider the meager overlap (even in a very fuzzy sense) 
between a browser's content menu and that of any native application.

In broad strokes, I'd suspect that we need to allow sites to completely 
replace the context menu. (Specifically, for sites that implement 
complex applications -- like Google docs or Zimbra -- but I don't know 
how to tell the difference in code). I would also be quite interested in 
author opinions on cases where they want a subset of browser menu items 
(such as clipboard ops) mixed in with site-specific items.

A short-term thing we (browsers) could try would be to always show some 
"important" subset of context menu items when the site is also supplying 
their own. But perhaps easier said than done: at least in Firefox 
there's a fair amount of complexity in determining what menu items to 
show... See 
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/nsContextMenu.js

[While I'm thinking of it, a related idea that's been bounced around in 
Firefox-land is having some way of granting modestly elevated 
permissions to a user's favorite sites. For example, if you "pin" a 
Gmail tab -- or maybe just visit it more frequently than average? -- 
perhaps it should be able to do a few more things than the average web 
page... Certainly not anything grossly sensitive w.r.t. 
privacy/security. But maybe it should be able to change the context 
menu, use more localstorage, etc. It's not something we're actively 
implementing, but is an interesting area to ponder.]

Justin



More information about the whatwg mailing list