Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix Enter on empty search menu (#1845)

Stanimir7048a8ea781e
diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsx
index f84bfd556..f7fff1962 100644
--- a/app/components/SearchAutocomplete.tsx
+++ b/app/components/SearchAutocomplete.tsx
@@ -1229,6 +1229,15 @@ function SearchAutocomplete(props: Props) {
open={isOpen.current}
/*onOpen={handleOpen}
onClose={handleClose}*/
+ filterOptions={(options: Array<SearchOptionType>, state: any) => {
+ const filteredOptions = options.filter(option => {
+ return option.label.indexOf(state.inputValue) > -1;
+ });
+ if (filteredOptions.length === 0) {
+ isOpen.current = false;
+ }
+ return filteredOptions;
+ }}
renderTags={value =>
value.map((option, index: number) => {
const action = actionValues.current.find(