values showed from datalist/list should be filtered by the field value by default and an attribute should disable that

RESOLVED FIXED in mozilla2.0b7

Status

()

Toolkit
Autocomplete
RESOLVED FIXED
7 years ago
2 months ago

People

(Reporter: mounir, Assigned: mounir)

Tracking

(Depends on: 1 bug, {dev-doc-needed})

Trunk
mozilla2.0b7
dev-doc-needed
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

7 years ago
Created attachment 473928 [details] [diff] [review]
WIP Patch

<datalist id='d'>
  <option>Foo</option>
  <option>Foobar</option>
</datalist>
<input list='d'>

The list should show "Foo" and "Foobar" if the user hasn't typed or has typed "F", "Fo", "Foo", "o" or "oo".

If mozNoFilter is set, the entire list will be shown.
(Assignee)

Comment 1

7 years ago
Created attachment 473930 [details] [diff] [review]
Patch v1
Attachment #473928 - Attachment is obsolete: true
(Assignee)

Comment 2

7 years ago
I hate doing that but I think it would be better to not try to write tests for that for the moment. We should push that for beta6 and tests can be written after. A lot of tests would have to be written for the list feature actually.

Gavin, do you think you can review this very small patch for Friday?
(Assignee)

Updated

7 years ago
Attachment #473930 - Attachment description: WIP Patch → Patch v1
Attachment #473930 - Flags: review?(gavin.sharp)
(Assignee)

Comment 3

7 years ago
Comment on attachment 473930 [details] [diff] [review]
Patch v1

Jonas, let me know if that's what you were expecting.
Do you want me to add an IDL attribute? Doesn't sound really useful considering that is a temporary attribute which may disappear -someday- for a standardized one?
Attachment #473930 - Flags: feedback?(jonas)
(Assignee)

Updated

7 years ago
Attachment #473930 - Flags: approval2.0?
Comment on attachment 473930 [details] [diff] [review]
Patch v1

Why is this using regexp matching? That seems like it would result in strange behavior if the user types '.', '[', '\' or other characters that have special meaning in regexps. Why not simply do a substring search using something like:

if (filter && label.toLower().indexOf(lowerFieldValue) < 0) {
  continue;
}
Attachment #473930 - Flags: feedback?(jonas) → feedback-
(Assignee)

Comment 5

7 years ago
Created attachment 473981 [details] [diff] [review]
Patch v1.1

Thanks, I didn't know indexOf ;)
Attachment #473930 - Attachment is obsolete: true
Attachment #473981 - Flags: review?(gavin.sharp)
Attachment #473981 - Flags: feedback?(jonas)
Attachment #473981 - Flags: approval2.0?
Attachment #473930 - Flags: review?(gavin.sharp)
Attachment #473930 - Flags: approval2.0?
Attachment #473981 - Flags: review?(gavin.sharp)
Attachment #473981 - Flags: review+
Attachment #473981 - Flags: feedback?(jonas)
Attachment #473981 - Flags: approval2.0?
Attachment #473981 - Flags: approval2.0+
(Assignee)

Updated

7 years ago
Version: unspecified → Trunk
(Assignee)

Comment 6

7 years ago
http://hg.mozilla.org/mozilla-central/rev/fa6c83c1a10e
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b6
(Assignee)

Updated

7 years ago
Depends on: 595415
mozNoFilter never got documented on MDN and so was almost re-implemented in bug 1349747. It also wasn't standardized as far as I can tell. I think it's an essential feature for @list to implement features such as Google search suggestions (which can include typo/spelling corrections) as described in some threads below.

Mentions in Google:
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=9785
* https://lists.w3.org/Archives/Public/public-whatwg-archive/2011May/0050.html
* https://lists.w3.org/Archives/Public/public-html-comments/2012Oct/0000.html
Depends on: 1044407
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.