JedWatson / JedWatson/react-select
menuPortalTarget add event on click on while document
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
I have next config
<Select
// isLoading={true}
ref={ref}
className="mobile-list__item__select"
classNamePrefix="mobile-list__item__select"
isSearchable={false}
options={prices}
placeholder={""}
menuPlacement="auto"
onChange={handlerSelect}
components={{ DropdownIndicator }}
menuPortalTarget={document.querySelector("body")}
/>
but when i first time open select, it add event on click to whole doc, and after close menu this click not destroyed.
If I remove menuPortalTarget, event not adding, but i use it for lift up menu.
How I can fix this?
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 by reproducing the reported Select configuration with menuPortalTarget={document.querySelector("body")} and compare it with the same select without the portal target. Inspect the menu-open and document-click behavior, then verify that any document-level click handling is removed after the menu closes.
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
- Needs clarification
- Newbie friendliness
- 35/100