[whatwg] <menu> and friends

David Young dyoung at pobox.com
Sat Dec 29 10:17:49 PST 2012

On Sat, Dec 29, 2012 at 01:23:20AM +0000, Ian Hickson wrote:
> On Sun, 23 Oct 2011, Eric Sh. wrote:
> >
> > I was trying out the HTML5 context menu in firefox and I saw that there 
> > is no way(in the specs) to create an empty menu with only selected 
> > context menu items in it.
> > 
> > So for example if I have an image element and I want to create a context 
> > menu with the items: "Rotate" and "Share" - I have to ask the browser to 
> > "Add" them to the regular context menu along with the ten other items 
> > that are already there.
> >
> > This makes a bulky context menu when I only need those two items and it 
> > is especially hurtful for user experience if the context menu is close 
> > to the bottom of the screen and is moved above the mouse cursor.
> > 
> > I suggest adding a way to ask the browser to create a brand new context 
> > menu with only those items.
> Not showing the browser's own context menu items is a hurtful user 
> experience as well; indeed, possibly a worse one.

I agree that it's an awful experience, especially because it turns the
user's habits against them.  If the Nth item in the menu is ordinarily
the UA's "Copy Link Location" and an app removes or re-orders items so
that the Nth item changes to "Rotate", "Share", or "Delete," then users
are in for a surprise when they make the automatic "Copy Link Location"

> However, the spec does allow the user agent to not add its own items if 
> that is considered better. Browsers are encouraged to provide an override 
> if they do that (e.g. shift-click brings up the full menu).

I think this is a step in the right direction, however, it also works
against automaticity.  Say that a click usually brings up the UA's
context menu.  In my app, however, a click brings up my app's context
menu sans UA items; shift-click brings up the UA's context menu.  This
has the same problem as I mentioned before: in the app, my automatic
gesture that starts with a click does some surprising thing instead of
copying the link location.

I think that good advice to the browser implementors is to either

1) reserve one gesture for the UA context menu ("click"), and a second
   gesture for the app context menu ("shift-click"), OR

2) always add the UA items to the context menu in consistent places, for
   example by adding app-specific context menu items after UA items


David Young
dyoung at pobox.com    Urbana, IL    (217) 721-9981

More information about the whatwg mailing list