JedWatson / JedWatson/react-select

Extra Space in Dropdown Menu of React Select Component on Initial Render

Open
#5,886 7 comments 2 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

The React Select component is not rendering correctly on the first load. The dropdown menu has extra space at the bottom. This issue only occurs on the initial render
image

After the initial render it works as expected:
image

CODE:

<Select
 isMulti
 options={roomValues}
 components={animatedComponents}
 value={productRooms}
 onChange={onChangeRoomSelect}
 getOptionLabel={(option) => option.roomNameObj[activeLanguage.id]}
 className="z-[99] h-max"
/>

Expected Behavior:
The dropdown menu should fit the number of items without any extra space.

Actual Behavior:
On the first render, the dropdown menu has extra space at the bottom. On subsequent renders, the dropdown menu fits the number of items correctly.

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 with the supplied React Select reproduction and inspect the Select component's initial render and dropdown sizing behavior. Compare the first render with subsequent renders using the provided code and screenshots. Done means the menu fits the number of items on the initial render as well as later renders.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.