twitter / typeahead.js

typeahead.js is a fast and fully-featured autocomplete library
http://twitter.github.io/typeahead.js/
MIT License
16.52k stars 3.21k forks source link

Scrollbar is not restored to "top" position after changing the query string #1102

Open paulinasd opened 9 years ago

paulinasd commented 9 years ago

I use typeahead.js library with height (css) on suggestions container added, in order to make list scrollable. The height of suggestions container is never changing, because my custom function that generates suggestion list, returns all source items, with the ones, matching the query, rendered on top of list.

Scrollbar on suggestions container is not restored after these steps:

Result: scrollbar is on the bottom of container, the same position it was set after entering the first query.

MorisatoK commented 9 years ago

Having the same issue, and because of #1141 it can not be worked around easily. This can also be reproduced on the example pages.

CC1337 commented 9 years ago

+1

bb commented 9 years ago

+1

CaptainPsycho commented 9 years ago

+1

Wound commented 7 years ago

Even though this is an old issue, if for any reason anybody is stuck on an old version of typeahead, this is what I did to solve the problem in my case with typeahead 0.9.3:

I patched typeahead.js. In function 'renderSuggestions' in class 'DropdownView' insert the following:

this._ensureVisibility(this.$menu.find(".tt-suggestion").first());

after the line

$dataset.show().find(".tt-suggestions").html(fragment);

At least that solved it for me. Happy patching!