[whatwg] Thoughts on Context and Popup Menus for Web Applications 1.0

Ian Hickson ian at hixie.ch
Thu Dec 2 17:26:15 PST 2004


On Wed, 20 Oct 2004, Matthew Raymond wrote:
>
> I have a few suggestions for menus outside the context of a menu bar. 
> The first is a suggestion for context menus (menus that, in Windows, 
> show up when you right-click on something). The second is for popup 
> menus (menus that appear when you click on or activate a control, et 
> cetera).
> 
> CONTEXT MENUS:
> 
> | <context>
> |  <menu id="clipboard">
> |   <command label="Cut" onclick="cbcut()"/>
> |   <command label="Copy" onclick="cbcopy()"/>
> |   <command label="Paste" onclick="cbpaste()"/>
> |   <command label="Clear" onclick="cbclear()"/>
> |  </menu>
> | </context>

I don't see the necessity for the <context> element. A menu is a menu, 
whether used in a menubar or a context menu or whatever.


> Personally, I don't see any utility in the ability to declare different 
> types of menus generically as above. Although using a single element to 
> do both would introduce less markup, it would make it more difficult to 
> determine how the menus are being used, since you'd have to hunt down 
> the element that actually calls a menu to determine a menu's use.

But the menu might be used in different ways at the same time, for example 
a menu could be in a menu bar, in a context menu, and in a button drop 
down menu.

It just seems silly to restrict each <menu> element to a single use.


> | <input type="text" name="text1" context="clipboard">

Yeah, an attribute seems like the most obvious way of associating an 
element with a context menu. I've added a place-holder section to the spec 
for this feature.


> For popup menus, we can use a similar approach to the one we used for
> context menus: [...]
> 
> | <button type="button" popup="zoomfactor">Zoom</button>

What's a popup menu? What's the difference between a popup menu and a 
pulldown menu in a menubar? (Think of how you would render the two cases 
in a voice-based browser.)

I posit that there is no difference. This would suggest we should use the 
same mechanism to indicate a pulldown menu in a <menubar> and a popup menu 
(as in the drop-down menu you get from a button).

Exactly what that mechanism is, I'm not convinced about. It needs to be 
something that can be used in legacy UAs to some extent, while still 
providing the functionality in a more effective way in WA1 UAs.


> REMOVING SECTION 2.3.3 FROM THE SPECIFICATION:
> 
> I believe we should remove section 2.3.3 ("Menu links") from the Web 
> Applications 1.0 specification. Having a hyperlink call up a menu via an 
> |id| attribute makes about as much sense and having a hyperlink open a 
> drop-down list.

The main reason I put the feature in there is that people do this today. 
Many "menu bars" on Web sites today use links that look exactly like "menu 
links", and so this was a cheap way of making migration easy.


> What happens when you try to open the hyperlink in another window or 
> tab? What happens if a hyperlink points to the anchor for a menu in 
> another HTML file?

This is all defined by the spec right now. (Namely: nothing, because it 
stop having hyperlink-like qualities; and nothing, because it's only a 
menu link if it points at the current file.)


> The deal breaker for me, though, is that you can't tell what the hyperlink
> does just by looking at it. For instance, what does the following do?...
> 
> | <a href="#guess">Does this point to a menu?</a>
> 
>    Now, figure out what this does:
> 
> | <button popup="obvious">This displays a popup menu.</button>

But the first one is backwards-compatible, and the second isn't. That's a 
deal-breaker for me. :-)

But I agree that it sucks, and I wish we had a better solution.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list