JedWatson / JedWatson/react-select
Scroll listeners is not removing when using closeMenuOnScroll
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Shouldn't we addEventListener only when dropdown of particular react-select is opened? and remove it when dropdown is closed?? Is it a bug or may be I should go for feature request?
Sandbox: https://codesandbox.io/s/react-select-v5-sandbox-forked-ghrqc7?file=/example.js

Just imagine if it would be 30 selectors on a page? react-select remove listeneres only on unmounting - but may be it would be more perfomant to remove after menu is closed?
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 example.js in the linked CodeSandbox and trace how closeMenuOnScroll registers its scroll listener across menu open and close events. Confirm the behavior with multiple selectors, then verify that listeners are active only while their menus are open and are removed when menus close.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100