Skip to content

Commit cb81130

Browse files
authored
ChipsInput - handle backspace with no chips (#2222)
1 parent 043f5d6 commit cb81130

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/incubator/ChipsInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const ChipsInput = forwardRef((props: ChipsInputProps, refToForward: React.Ref<a
9999
const keyCode = event?.nativeEvent?.key;
100100
const pressedBackspace = keyCode === Constants.backspaceKey;
101101

102-
if (pressedBackspace && !fieldValue.current) {
102+
if (pressedBackspace && !fieldValue.current && chips.length > 0) {
103103
if (isUndefined(markedForRemoval) || markedForRemoval !== chips.length - 1) {
104104
setMarkedForRemoval(chips.length - 1);
105105
} else {

0 commit comments

Comments
 (0)