React-select: [v2] onMenuScrollToBottom does not fire if dropdown is not scrollable on mount

Created on 27 Jul 2018  路  4Comments  路  Source: JedWatson/react-select

@JedWatson I wasn't sure how to test but you can see a codesandbox example here where opening the dropdown with options already loaded allows for the onMenuScrollToBottom callback to log "bottom" in the console. However if you clear the options before opening the dropdown, the callback will not fire after options have loaded.

I've submitted this PR as a fix.

Thanks!

issubug-unconfirmed issureviewed

Most helpful comment

@JedWatson What's the next step to resolve this bug?

There's two existing PRs addressing this usecase, neither with clear feedback on what needs to be done differently to accept the PRs:

All 4 comments

// src/internal/ScrollCaptor.js

  startListening(el: HTMLElement) {
    // bail early if no scroll available
    if (el.scrollHeight <= el.clientHeight) return; // <------- listening stops here

    // all the if statements are to appease Flow 馃槩
    if (typeof el.addEventListener === 'function') {
      el.addEventListener('wheel', this.onWheel, false);
    }
    if (typeof el.addEventListener === 'function') {
      el.addEventListener('touchstart', this.onTouchStart, false);
    }
    if (typeof el.addEventListener === 'function') {
      el.addEventListener('touchmove', this.onTouchMove, false);
    }
  }

What about add prop for allow listen scrolls always?

Hi, is @pyreta 's change going to be merged anytime soon? I'm having the same issues.

@JedWatson What's the next step to resolve this bug?

There's two existing PRs addressing this usecase, neither with clear feedback on what needs to be done differently to accept the PRs:

Any update on this issue?

To me this fix seems ok: https://github.com/JedWatson/react-select/pull/3219

We have this issue with paginated select component. If the select is opened before the first page is loaded the pagination is broken.

The fix I've used it is kinda hacky and I would like to get rid of it. I change the key on select-menu when first page is loaded. This makes the menu remount, menu as scroll and it listens to scroll events.

I am open to contribute to fix this issue.

Thank you!

Screenshot 2019-06-18 at 11 05 38

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AchinthaReemal picture AchinthaReemal  路  3Comments

ericj17 picture ericj17  路  3Comments

pashap picture pashap  路  3Comments

Meesam picture Meesam  路  3Comments

pgoldweic picture pgoldweic  路  3Comments