From 570e1eff4830a68b9e1841a43d51c82f990c341e Mon Sep 17 00:00:00 2001 From: whirmill Date: Thu, 10 Aug 2017 17:11:56 +0200 Subject: [PATCH] option results cleared when the last char in input is deleted using backspace --- src/Autocomplete.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Autocomplete.jsx b/src/Autocomplete.jsx index 630ef44..66faf0c 100644 --- a/src/Autocomplete.jsx +++ b/src/Autocomplete.jsx @@ -119,7 +119,9 @@ export default class Autocomplete extends PureComponent { input.selectionEnd === input.value.length && input.selectionStart !== 0) { const value = input.value.substr(0, input.selectionStart); - this.setValue(value.substr(0, value.length - 1), this.props.options); + if (value.length > 1) { + this.setValue(value.substr(0, value.length - 1), this.props.options); + } updateInputNode(input, value); } }