JedWatson / JedWatson/react-select

Input defaults to previously entered value when dropdown clicked

Open
#5,378 0 comments 0 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

When using react-select to select between values, clicking the dropdown, entering a value with 2 or more characters, and then entering a value with only the first character, the select defaults to the previously entered value.

For example, in a select with options 1 to 50, click the dropdown, type 20 and press enter to select 20. Then click the dropdown, type just 2 and press enter. The select component will have defaulted to 20 instead of the entered value of 2.

When the select component is highlighted by tabbing into it and a value is entered, the first option is focused and submits normally. Clicking the dropdown instead, removes the focus from the first option. This causes it to submit as the previously selected option if the entered value's first character matches the previously selected ones'.

After having selected Green,
TABBING into the component and typing highlights the first matching option:
Screenshot from 2022-10-13 12-01-05

CLICKING the component and typing highlights only the previously selected option:
Screenshot from 2022-10-13 12-00-31

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 behavior in the react-select component using the issue's 1–50 example: select 20, reopen the dropdown, type 2, and press Enter. Compare that result with the tab-focused interaction, where the first matching option is focused. Done means clicking the component and entering a shorter matching value selects that entered value rather than the previously selected option.

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.