Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dropdown scrolling to top when the virtual scroll plugin fetch next page #821

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MatTheCat
Copy link

@MatTheCat MatTheCat commented Dec 1, 2024

Fixes #556 (closed for inactivity but still present).

I stumbled upon two distinct issues when investigating this one:

  • the lastQuery property was used for checking the UI staleness, as such it was often reset independently of the search query. When the virtual scroll plugin triggers refreshOptions the UI is stale so the first option is activated and scrolled to, while it shouldn’t happen since the query didn’t change. This is fixed by splitting the staleness check in a isDropdownContentStale property, which is updated independently of lastQuery.
  • the “loading_more” element is made so that you can select it when navigating using the keyboard. Problem is, it will be removed by refreshOptions which then won’t find it in the dropdown and activate — and scroll to — the first option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Virtual Scroll Plugin scrolls to top when next url loads
1 participant