fix: only navigate to last tag on backspace if input is empty

This commit is contained in:
Antonella Sgarlatta
2021-05-27 10:56:21 -03:00
parent 0200351ecc
commit eb3227cffd

View File

@@ -100,7 +100,7 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
onBlur={closeOnBlur}
onFocus={showDropdown}
onKeyUp={(event) => {
if (event.key === 'Backspace') {
if (event.key === 'Backspace' && searchQuery === '') {
lastTagRef.current?.focus();
}
}}