W3C home > Mailing lists > Public > public-html@w3.org > March 2012

RE: Option element in a Datalist with no label

From: Sharon Newman (COHEN) <Sharon.Newman@microsoft.com>
Date: Thu, 15 Mar 2012 19:23:24 +0000
To: Boris Zbarsky <bzbarsky@MIT.EDU>, "public-html@w3.org" <public-html@w3.org>
Message-ID: <BB015EE6F6DAC54393E9529E21278DE536E9814C@TK5EX14MBXC121.redmond.corp.microsoft.com>
I see I missed this example in the spec which advocates only using the value attribute: 

If the autocompletion list is merely an aid, and is not important to the content, then simply using a datalist element with children option elements is enough. To prevent the values from being rendered in legacy user agents, they need to be placed inside the value attribute instead of inline.

<p>
 <label>
  Enter a breed:
  <input type="text" name="breed" list="breeds">
  <datalist id="breeds">
   <option value="Abyssinian">
   <option value="Alpaca">
   <!-- ... -->
  </datalist>
 </label>
</p>

http://dev.w3.org/html5/spec/common-input-element-attributes.html#the-list-attribute

I guess with the current text " The user agent may use the suggestion's label to identify the suggestion if appropriate." It's implied that the user agent could also use anything else, including the value to identify the suggestion.

This resolves my question.  Thanks!
-sharon

-----Original Message-----
From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU] 
Sent: Thursday, March 15, 2012 8:04 AM
To: public-html@w3.org
Subject: Re: Option element in a Datalist with no label

On 3/14/12 10:24 PM, Sharon Newman (COHEN) wrote:
> With the following code:
> <input list="test" type=text>
> <datalist id=test>
> <option value="a">
> <option value = "b">
> <option value="c">
> </datalist>
>
> According to the spec, these options don't have a label, however, in 
> FF and Opera today the value is being displayed as the label.

"Displayed as the label" in which sense?

If you're looking at the actual behavior when typing in the input, the relevant spec section is http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-list
which says:

   The user agent may use the suggestion's label to identify the
   suggestion if appropriate.

There's nothing past that in the spec that really talks about how the suggestions should be exposed to the user, as far as I can see. 
Specifically, nothing requires the UA to actually present to suggestions, and nothing requires the UA to use the suggestion labels to identify the suggestions.  Unless I'm missing something, of course.

-Boris
Received on Thursday, 15 March 2012 19:24:21 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:30 UTC