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

useLayoutEffect of <MenuPlacer /> component should listen for react-select's isLoading prop #5733

Open
AbeykoonOshan opened this issue Aug 21, 2023 · 3 comments · May be fixed by #5736
Open
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@AbeykoonOshan
Copy link

AbeykoonOshan commented Aug 21, 2023

Issue type: Bug

Issue recreation steps as follows,

  1. Click on the dropdown field input. (Then we will get the "Loading" message. This is working as expected)
    image

  2. After the options are loaded into the dropdown, the menu doesn't get displayed above the field as it should. The menu does get rendered below the control.
    The menuPlacement prop "auto" is expected to kick-in in this state.
    image

This is only happens once.

The issue is reproduceable in following code sandbox. (Be sure to click on the dropdown field of the page before the setTimeout timer)
https://codesandbox.io/s/strange-firefly-npzlhd?file=/src/App.js

Suggestion

I'm not sure whether this is feasible or not, but i think that we should perform the menu placement calculation after isLoading state has been set to true since that is an indicator that the options for the dropdown is completely loaded.

Affected react-select version: 5.7

@AbeykoonOshan AbeykoonOshan added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Aug 21, 2023
labkey-nicka added a commit to labkey-nicka/react-select that referenced this issue Aug 22, 2023
@labkey-nicka
Copy link

@AbeykoonOshan I've issued PR #5736 that seeks to address this. See https://codesandbox.io/s/silly-dust-fhx83r for an example. Let me know if this matches the behavior you would expect.

@AbeykoonOshan
Copy link
Author

AbeykoonOshan commented Aug 23, 2023

Hi @labkey-nicka ,

Thanks

I saw your fix and the testable sample, it all works now.

Do you have any clue on when this PR (#5736) will be merged.

I will close my issue since we already have a PR for this.

@labkey-nicka
Copy link

@AbeykoonOshan I would recommend keeping this open. Once the PR is merged it will automatically close this issue.

@AbeykoonOshan AbeykoonOshan reopened this Aug 24, 2023
labkey-nicka added a commit to labkey-nicka/react-select that referenced this issue Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants