[whatwg] input element list attribute and filtering suggestions

Ian Hickson ian at hixie.ch
Thu Dec 30 16:36:44 PST 2010


On Thu, 23 Sep 2010, Mounir Lamouri wrote:
> 
> The list attribute on input elements let the author specify a list 
> of pre-defined suggestions via the datalist element (each option of the 
> datalist is a suggestion). It looks like the idea is to have all the 
> suggestions showing like a combobox which is more or less confirmed by 
> Hixie. [http://www.w3.org/Bugs/Public/show_bug.cgi?id=9785]
> 
> However, it sounds like having a static combobox would only fulfill some 
> use cases (ie. when a very small set of suggestions is defined). In most 
> obvious situations, having a list with all the suggestions would be 
> annoying. So, it might be interesting to have the list filtered with the 
> current element's value to be able to use the list attribute for large 
> list and have a boolean attribute to enable or disable the filtering.

There is a distinction between the combo-box style UI of a finite list of 
suggestions, and "Google suggest"-style UI -- but that difference is not 
related to filtering, IMHO. It's more related to the volume of possible 
data. In both cases you would want filtering for an ideal UI, IMHO.


> One simple use case would be a city transportation website. If you have 
> to type a station name in a field it might be much more user friendly to 
> have a filtered list.
> 
> Actually, I do not see any use case of the list attribute without 
> filtering. To me, it seems like a replacement of a select with options 
> and an input fields in the case of "none of the above". And I do not 
> think this replacement would be better. I am wondering what were the use 
> cases in mind?

The use case is more or less what you describe -- just look around your 
operating system's configuration UI for instance for lots of examples of 
this kind of thing.

The thing that makes this different than "Google suggest"-style UI is that 
in the latter case you need a script that continually polls for more 
appropriate suggestions and updates the list -- for this kind of thing 
we'd probably want to use a direct API, we wouldn't want to have scripts 
have to poke at the <datalist> DOM in real time.

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