[whatwg] Comment on Forms 2.0: OPTGROUP Nesting

Jose Fandos jose.fandos at sonnd.com
Mon Jun 28 11:42:49 PDT 2004

> levik wrote:
>> I think the web forms 2.0 spec should include support for nesting
>> OPTGROUP tags inside of a SELECT element. Current OPTGROUP
>> specification for some reason limits grouping to one level, which
>> allows UAs to implement it in a fairly useless way (by inserting a
>> non-selectable line item into the menu)
>> Nesting OPTGROUPs would allow hierarchical menu structures to be
>> implemented for single-line SELECTs, and tree-like structures to be
>> shown in multi-line select (ones with SIZE="x").
>     A while ago, I suggested the use of <select> as a way of
> implementing menus. If nested <optgroup> elements were permitted, a
> select could easily be used to define a menu. It could be defined like
> this:
> <select type="menu" label="File" accesskey="f">
>    <optgroup label="New" accesskey="n">
>      <option label="Document">Document</option>
>      <option label="Template">Template</option>
>      <optgroup label="Web Application">
>        <option label="Web Forms 2.0">Web Forms 2.0</option>
>        <option label="XForms 2.0">XForms 2.0</option>
>        <option label="SVG 1.2">SVG 1.2</option>
>        <option label="XAML">XAML</option>
>        <option label="XUL">XUL</option>
>      </optgroup>
>    </optgroup>
>    <option label="Open" accesskey="o">Open</option>
>    <option label="Save" accesskey="s">Save</option>
>    <option type="menuseparator" disabled>-----</option>
>    <option label="Exit" accesskey="x">Exit</option>
> </select>

I find that the select chrome has always been missing a real "size", an
attribute for its lenght. In many occassions I've found that the design
didn't allow a select because the lenght of the longest option was too
long and had to resort to text input.

I imagine that adding such an attribute (length?) would control the length
of the chrome and the browser can expand the dropdown box to fit in the
longest option in the select. That would make it very versatile. It would
look something like this.

   /---- length ---/
   |Please select one of the options offered below |
   |option 1                                       |
   |option 2                                       |
   |option 3 is very long                          |
   |option 4 is even longer                        |
   |optionally this could be very convenient       |

If this is offtopic, please excuse and ignore. If there is a way of
currently doing this I certainly have not been able to find it.



More information about the whatwg mailing list