Text input and big datalist is slow
JulienCC last edited by
I'm building a web application and I tried to use datalist as a suggestion source for a text input.
Il works well in Opera on small lists but when I use a big list (arround 4000 elements) the browser becomes really slow.
There's a few seconds freez if I type many letters in a row. If the matched set contains many rows (if I typed a single letter for example), the scroll is very laggy.
It seems that the filter algorithm of the datalist is really slow and does not follow the guidelines of the HTML specifications : https://html.spec.whatwg.org/multipage/input.html#the-list-attribute
User agents are encouraged to filter the suggestions represented by the suggestions source element when the number of suggestions is large, including only the most relevant ones (e.g. based on the user's input so far). No precise threshold is defined, but capping the list at four to seven values is reasonable. If filtering based on the user's input, user agents should use substring matching against both the suggestions' label and value.
The specifications recommend limiting the choice to 5 or 7 results.
Ofcourse it wouldn't be such a problem if the gigantic scroll list was not that slow.