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 infinite scroll when the scrollbar is not visible #5575

Merged
merged 1 commit into from Jul 20, 2019
Merged

Commits on Jul 20, 2019

  1. Fix infinite scroll when the scrollbar is not visible

    Ever since the 4.0.0 release of Select2, there has been a bug where
    if you enabled infinite scrolling but did not return enough results
    on the first load of AJAX to show a scrollbar, then infinite
    scrolling would not be enabled and you could not view anything other
    than the first page of results. The solution for this was first
    proposed in #3888 but it was closed off because of inactivity and
    missing tests.
    
    This fixes the issue by performing the check to see if more results
    should be loaded both on scroll and also when the results are first
    loaded. This solves the issue that we were seeing before, because
    the plugin knows it needs to load in more results, just it did not
    receive the scroll event before and thus was not able to actually
    load in the new results.
    
    This has the potential to trigger multiple AJAX requests to load in
    multiple pages of results if the user has the ability to see many
    options, but only a few are being loaded at a time.
    
    This also adds tests for infinite scrolling, both to ensure that
    it will attempt to load additional pages, even without the scrollbar,
    and to ensure that the regular behaviour of not loading additional
    pages when the scrollbar is visible is preserved.
    
    Fixes #3088
    kevin-brown committed Jul 20, 2019
    Copy the full SHA
    2c9cdda View commit details
    Browse the repository at this point in the history