[whatwg] Looking at menus in HTML5...

Matthew Raymond mattraymond at earthlink.net
Tue Dec 5 03:19:40 PST 2006


   This is my current understanding of how menus are supposed to work in
HTML5:

| <menu type="popup">
|   <!-- A menu item that degrades to non-visible on legacy user     -->
|   <!-- agents.                                                     -->
|   <command label="Item Text">
|
|   <!-- A submenu who's label degrades into nothing on legacy user  -->
|   <!-- agents.                                                     -->
|   <menu label="Item Text"></menu>
|
|   <!-- A menu (with possible submenus) that degrades a select      -->
|   <!-- control.                                                    -->
|   <select>[...]</select> <!-- Additional Markup Here. -->
|
|   <!-- A menu item that degrades into a list item.                 -->
|   <li>Item Text</li>
|
|   <!-- A menu item that serves as a link and degrades into a list  -->
|   <!-- item with a hyperlink.                                      -->
|   <li><a href="URL">Item Text</a></li>
|
|   <!-- A submenu that degrades into a list item containing a list. -->
|   <li>
|     Item Text
|     <menu>[...]</menu>
|   </li>
|
|   <!-- A submenu (with possible nesting) that degrades into a      -->
|   <!-- list item containing a select control.                      -->
|   <li>
|     Item Text
|     <select>[...]</select>
|   </li>
|
|   <!-- A separator that degrades into a list item with a           -->
|   <!-- horizontal rule.                                            -->
|   <li><hr></li>
|
|   <!-- A separator that degrades into a horizontal rule.           -->
|   <hr>
| </menu>

   Any |label|-free <menu> elements that are immediate children of a
<menu type="popup"> or <menu type="toolbar"> should be ignored. A menu
within a menu shouldn't be used for anything but a submenu. If we want
true command groups, we need a new element, perhaps named "cmdgroup" or
something. (Is there a sufficient use case for non-hierarchical groups
that produce separators? Or is <hr> sufficient? Note that <hr> degrades
to a visible form on legacy user agents.)

   I'm not sure the spec says this or not, but any <menu> that is the
descendant of a <menu type="popup"> or <menu type="toolbar"> element
should be ignored if it has an explicit |type| attribute value of "list"
or "toolbar". Toolbars and popups should only contain popup submenus, so
anything that isn't <menu> (with no |type|) or <menu type="popup">
should be ignored.

   Is there a ways to set an <option> or <li> element as default item?
I'll have to check the spec again, but I believe some features are
specifically reserved for <command>...



More information about the whatwg mailing list