Select with `clearable={false}` can still be cleared with backspace
See original GitHub issueHere’s a Plunker: https://plnkr.co/edit/ZaFyPW0zGqcf2oWeVnaL?p=preview
Note that although it has clearable={false}
, you can still clear the value by focusing the field and pressing Backspace. To disable this behavior, you have to also explicitly set deleteRemoves={false}
.
This is surprising to me; I would expect that clearable={false}
would mean that you can never get a null (or empty array, to be more precise) value from the field.
Maybe deleteRemoves
should default to the value of clearable
? Or require both deleteRemoves
and clearable
to be true for the backspace behavior?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:21
- Comments:8
Top Results From Across the Web
What is the alternative of [clearable] in ng-select - Stack Overflow
if 'clearable' property is set to false, and clearOnBackspace is set to true, user can remove single item using backspace button. · use...
Read more >Delete & Backspace keys are not working in Excel (Desktop
Backspace clears the content of the active cell i.e., it only can clear the first cell where we start selecting. In other Office...
Read more >API - React Select
Clear all values when the user presses escape AND the menu is closed. boolean ... The cache will remain until cacheOptions changes value....
Read more >Backspace clears the ComboBox SelectedItem - Telerik
Backspace clears the ComboBox SelectedItem ... I have set the IsEditable property to False, so the user can only select values from the...
Read more >QLineEdit Class | Qt Widgets 6.4.1
Text can be selected with setSelection() or selectAll(), ... This property holds whether the line edit displays a clear button when it is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pohsoon Yes you can.
react-select
v2
gives you the ability to redefine the internal components with itscomponents
prop. Components that can be redefined also include theClearIndicator
. You just have to set theClearIndicator
incomponents
prop tonull
, and the indicator will not render, but the clearing functionality will still be present.CodeSandbox
Actually I have opposite problem, I specified
backspaceRemoves={true} deleteRemoves={true}
and I can not remove selected value until I start typing.