JedWatson / JedWatson/react-select

MenuList with simplebar-react and menuPlacement="auto" never uses placement="top"

Open
#4,812 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug:
react-select@v4.3.1 with simplebar-react@2.3.5 and menuPlacement="auto" is always positioning menu to "bottom".

When using react-select in combination with simplebar-react the functionality of menuPlacement="auto" is lost and it always falls back to menuPlacement="bottom".

For some reason the MenuPlacer is not correctly determining the placement when used in combination with simplebar-react.

Test case: https://codesandbox.io/s/suspicious-rumple-ni52n

How to reproduce: Make the browser window small enough and open the dropdowns.
The dropdown with placeholder "Select without Simplebar" will render the menu above. (correct)
The dropdown with placeholder "Select with Simplebar" will render the menu below (wrong)

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

Reproduce the two dropdown cases in the linked CodeSandbox with a small browser window. Then inspect MenuPlacer in packages/react-select/src/components/Menu.js, focusing on how menuPlacement="auto" is determined with simplebar-react. Done means the simplebar dropdown chooses top when there is insufficient space below, matching the non-simplebar case.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.