JedWatson / JedWatson/react-select

menuPlacement=auto is not recalculated when options change after menu is opened

Open
#5,642 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-unconfirmed
Dominant language
TypeScript
Stars
28k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

When using AsyncSelect with menuPosition="auto" towards the bottom of the page, once the options load the menu will be off screen.

image

It appears the menu position is not recalculated if the options/size of the menu changes after its opened.

https://github.com/JedWatson/react-select/blob/3aee85cb8c5d045d47d45b0f9ebd0c58d4593c42/packages/react-select/src/components/Menu.tsx#L342-L363

Reproduction sandbox https://codesandbox.io/s/react-select-menuplacement-repro-wqkuew?file=/src/App.js https://wqkuew.csb.app/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/react-select/src/components/Menu.tsx at the linked menu-positioning code, then reproduce the behavior in the provided CodeSandbox with AsyncSelect and menuPosition="auto". Trace how menu size or options changes are handled after opening; done means the menu is repositioned when asynchronously loaded options change its size and no longer overflows the viewport.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.