downshift-js / downshift-js/downshift
[BUG] Delete character (0x7F) propagates to `inputValue` when deleting a selected item
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 936
- PR merge metrics
- No merged PRs in 30d
Description
- `downshift` version: 6.1.7
- `node` version: 14.18.1
- `npm` (or `yarn`) version: yarn 1.22.15
**Description of the bug:**
When the `useMultipleSelection` hook uses a controlled `selectedItems` prop, the delete character (0x7F) gets outputted to the text input after deleting the last selected item.
**Code**:
Here's a code sandbox with the sample code found in the docs but `selectedItems` is used instead of `initialSelectedItems`:
https://codesandbox.io/s/downshift-bug-controlled-multi-selection-dc1u7?file=/src/DropdownMultipleCombobox.js
**Steps to reproduce:**
1. Click on one of the selected items (apple or orange)
2. Press DELETE
3. Press DELETE
4. Delete character (0x7F) should appear inside the text input
https://user-images.githubusercontent.com/1303285/152700531-8eb0316e-f34b-4432-897c-e959dc608acc.mp4
Contributor guide
Assessment
This issue has not been assessed yet.