JedWatson / JedWatson/react-select

Focus state not updated after selected a value, when using Components

Open
#5,584 3 comments 3 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

Hi. I've found that when you use components (not all), if you select a value, then click anywhere to "blur" the select, it won't remove the focus state.

I've managed to reproduce it: https://codesandbox.io/s/musing-mcnulty-o4rz92?file=/src/App.tsx

Animation

In my 4 examples :

  1. no components
  2. IndicatorSeparator
  3. SelectContainer (❌ doesn't work)
  4. Control (❌ doesn't work)

The minimal failing code would be:

<Select
  value={currentLetter}
  options={letters}
  onChange={(option) => setCurrentLetter(option || undefined)}
  components={{
    SelectContainer: (p) => <components.SelectContainer {...p} />
  }}
/>

In my real project, I'm using a custom Control to add elements before the input + classNames. And now I can't get the focus state to go off.

Does anyone have an idea about that?

Thanks.

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 issue using the linked CodeSandbox and the minimal Select example with custom SelectContainer or Control components. Compare the focus behavior across the listed component variants; done means selecting a value and clicking elsewhere removes the focus state consistently.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.