[whatwg] Suggestion for Menus in Web Forms 2.0

Ian Hickson ian at hixie.ch
Sun Aug 8 13:40:47 PDT 2004


On Sun, 8 Aug 2004, Matthew Thomas wrote:
>> 
>>    <menubar>
>>     <menu label="File">
> 
> Ah! Your problem there is that you're using an attribute for data that 
> should be human-readable by default (even in the absence of CSS or WA1 
> support). Don't do that; use an element instead.

Your mistake is assuming that it should be visible by default.

There are two cases. The "it should be visible" case and the "it should 
not be visible" case. In the "it should be visible" case, it all works 
already as defined; the markup would be:

   <menubar>
    <h3>File</h3> <!-- or <h>, or <span>, or <a>, or whatever -->
    <menu>
     ...

The problem is in the case where you _don't_ want it visible in downlevel 
UAs.


>     <menulist>
>      <menu id="fm">
>       <menutitle>File</menutitle>

That won't work, the <menu> is display:none.


>> The menu element itself is display:none, and its display (on visual media)
>> is micromanaged by the UA. The question is how do you style the label? Where
>> is it? How does it get rendered?
> 
> After getting rid of the menu {display: none}

Why on earth would you want the menu visible? It's a menu. It should be 
hidden until activated.


> something like this would probably be a good start:
> 
> menu {cursor: default !important;}
> menutitle {display: inline;}
> menutitle::after {content: "  #▾"}
> menulist menutitle {display: block;}
> menulist menutitle::after {content: none;}
> menulist optgroup menutitle::after {content: " ▸"}
> menu li {display: none;}
> menu::active itemgroup, menu::active li {display: block;}
> menu::active menutitle, menu li::active {color: invert; background-color:
> invert;}

This wouldn't work for numerous reasons (it only works for your very 
limited markup, and not for all the cases the current proposals allows). 
The main reason, though, is that menus are native, not rendered by CSS, 
and therefore CSS is irrelevant here.

This still doesn't answer the question, which is, where does the label 
come from in the label-attribute case.

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