JedWatson / JedWatson/react-select
menuPlacement not working with AsyncSelect when options changes e.g. from 0 results to 6 results
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
the use case is that you have a search input with autocomplete, initially there are no options but when you start to type options appear. the issue is that after more options fill the menu, the menu placement is not updated.
here is a codesandbox to reproduce
https://codesandbox.io/s/awesome-moon-8fbmtp?file=/src/App.js
and here the explanation about the codesandbox.
not working when initially no options available
initially the first request is getting an empty array as response, thats why its rendering no results. since no results fits the menu is rendered below. but after typing more options arrive, the menu is updated but the placement is not. there is not enough space and I would expect the menu to be rendered above the dropdown
expected working when initially enough options are available
when you set the showExpected in the codesandbox to true, then the sandbox example has enough options initially. the menu is then correctly placed above the dropdown:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox at src/App.js and reproduce the AsyncSelect case where the first response has no options and a later response has six. Trace the menuPlacement behavior during that options change. Done means the menu repositions above the dropdown when space becomes insufficient, while the showExpected case remains correctly placed.
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
- Mostly clear
- Newbie friendliness
- 45/100