react-component / react-component/select

Typing `Backspace` on `input` inside the custom component `dropdownRender` remove last selected value

Open
#834 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

Date Seen
(21 Sep, 2022)

Versions

  • Operating System and version: MacOS 12.6
  • Browser and Version: Brave based on Chromium: 105.0.5195.102
  • Lib: rc-select@^14.1.2

Bug Description
I customized the dropdownRender component. Inside this component is the input box to filter value.
When I remove the text on input by backspace. The selected value is removing the last item. I inspected the library rc-select, I think the root cause from the event listener listen to any input element inside Select component.

Steps to Reproduce

  1. Select multiple values.
  2. Type some text on input in the dropdown.
  3. Type Backspace to remove text on input.

Actual Behavior
The last item on the selected value was removed on Select

Expected Behavior
Shouldn't affect the selected value.

Codesandbox: https://codesandbox.io/s/rc-select-multiple-search-inside-dropdown-6ibpj6?file=/App.tsx

Contributor guide

No contributing guide indexed for this repository

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 from the linked CodeSandbox in App.tsx, using a multiple Select with a custom dropdownRender input. Trace how Backspace events from that nested input reach Select, then verify that deleting its text no longer removes the last selected value.

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.