This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9785 - Add a "filter" attribute. If set, the user agent will filter the datalist. If not, filter won't be filtered automatically (unless you do some sort of filtering by javascript or/and server-side)
Summary: Add a "filter" attribute. If set, the user agent will filter the datalist. If...
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 enhancement
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Keywords: NE
Depends on:
Reported: 2010-05-21 09:26 UTC by contributor
Modified: 2014-09-19 18:35 UTC (History)
9 users (show)

See Also:


Description contributor 2010-05-21 09:26:28 UTC

Add a "filter" attribute. If set, the user agent will filter the datalist. If
not, filter won't be filtered automatically (unless you do some sort of
filtering by javascript or/and server-side)

Posted from:
Comment 1 Jonas Sicking (Not reading bugmail) 2010-08-04 18:36:59 UTC
We ran into this issue too when discussing the firefox implementation of datalist.

Two usage scenarios we could see for <datalist> are:

A static set of completions which the user will usually choose between. For example:

<input list=managers>
<datalist id=managers>

A dyanmically populated list based on more complex conditions. Consider for example the google autosuggest feature.

function handleInput(value) {
  var xhr = new XMLHttpRequest();"GET", "/suggestions.cgi?" + value);
  xhr.onload = function() {
    document.getElementById("suggestions").innerHTML = xhr.responseText;
<input list=suggestions oninput="handleInput(this.value);">
<datalist id=suggestions></datalist>

In use case 1 it makes sense for the UA to only display results that contain (or even starts with) the string that the user has typed so far. In use case 2 it makes sense to display *all* the results that the server cgi script thought were relevant. For example if I type "200 sek" in google, the first result it shows is "200 Swedish kronor = 27.9998 US dollars".

I suspect that letting the UA apply filtering is a reasonable default. However it would be very good to be able to set a boolean attribute on either the <input> or the <datalist> stating that filtering should not happen.
Comment 2 Ian 'Hixie' Hickson 2010-09-10 09:16:36 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:

Status: Rejected
Change Description: no spec change

Currently the spec doesn't say if there should be filtering or not — it just says that these are the suggested values and leaves the UI to the UA.

The idea here is to provide a combo box, not to provide a "Google suggest"-like interface. The latter would probably be better handled by a pure JS solution with callbacks.

I would recommend that browser vendors play with offering different attributes (using the vendor-extension syntax!) to experiment with what the best way to extend this feature would be, and report back. We can then update the feature appropriately.
Comment 3 Mounir Lamouri 2010-09-30 20:50:50 UTC
Gecko has this kind feature implemented (will be in Gecko 2.0/Firefox 4).
Reopening to keep that in mind.
Comment 4 Mounir Lamouri 2010-09-30 22:12:27 UTC
This thread describes the current Gecko behavior and why we do that:
Comment 5 Ian 'Hixie' Hickson 2010-10-03 18:37:57 UTC
Thanks, I'll take a look and see if the implementation experience suggests spec changes are needed.
Comment 6 Ian 'Hixie' Hickson 2010-10-12 06:26:13 UTC
The current situation (a mozNoFilter attribute) seems reasonable for experimentation. Let's revisit this a few months after this has been shipped widely, and see how people are using it. I think this is definitely an area where we'll need to add new features to the platform, but I'm not sure it makes sense to do it straight away  we don't want to go too far down a rabbit hole without the reality check of author usage, the further we go the harder it will be to climb back out, as it were (e.g. we'll end up with features that are hardly used but used enough to require implementation everywhere, which is a high burden on the platform).
Comment 7 Michael[tm] Smith 2013-01-24 07:45:20 UTC
This bug was cloned to create HTML WG bug 19025.
Comment 8 Ian 'Hixie' Hickson 2013-10-01 23:01:40 UTC
Anyone know how much usage moznofilter="" is getting? I'm not seeing any developer chatter about this feature at all in a Google search for it.
Comment 9 Ms2ger 2014-07-26 10:17:03 UTC
I filed <>.
Comment 10 Ian 'Hixie' Hickson 2014-07-28 21:27:40 UTC
FWIW I examined our internal data and found zero organic uses of moznofilter. (Finding zero uses of anything is actually quite impressive.)
Comment 11 Ian 'Hixie' Hickson 2014-09-05 19:49:13 UTC
Given the data above, I think the way to go here is for browsers to always filter unless there's only a small number of options, in which case not filtering probably makes sense. Maybe we should hard-code that number in the spec? But then again, maybe not? Hard to say.
Comment 12 Ian 'Hixie' Hickson 2014-09-19 18:34:09 UTC
I did what I described in comment 11, and I'm calling it a day for this bug. If there ends up being a need for nofilter beyond that, please do file a new bug (or reopen this one). Thanks.
Comment 13 contributor 2014-09-19 18:35:22 UTC
Checked in as WHATWG revision r8792.
Check-in comment: Suggest that browsers filter the list='' suggestions if there's more than 4 to 7.