Skip to content

Commit

Permalink
🐛 fix search bar category bug and enter event bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoLyn committed Jul 22, 2024
1 parent 4d046aa commit e2b68b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/components/common/store/searchReducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,12 @@ const createSearchParamFrom = (i: ParameterState): SearchParameters => {
p.filter = appendFilter(p.filter, f(i.polygon));
}

if (i.categories) {
if (i.categories && i.categories.length > 0) {
const f = cqlDefaultFilters.get("CATEGORIES_IN") as CategoriesIn;
p.filter = appendFilter(p.filter, f(i.categories));
const categoryFilter = f(i.categories);
if (categoryFilter) {
p.filter = appendFilter(p.filter, categoryFilter);
}
}

return p;
Expand Down
7 changes: 5 additions & 2 deletions src/components/search/InputWithSuggester.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,13 @@ const InputWithSuggester: FC<InputWithSuggesterProps> = ({
const handleKeyDown = (
event: React.KeyboardEvent<HTMLTextAreaElement | HTMLInputElement>
) => {
if (event.key === "Enter") {
if (event.key === "Enter" && open === true) {
setOpen(false);
handleEnterPressed(event, false);
}
if (event.key === "Enter" && open === false) {
handleEnterPressed(event, false);
}
handleEnterPressed(event, open);
};

const [searchFieldWidth, setSearchFieldWidth] = useState<number>(0);
Expand Down

0 comments on commit e2b68b6

Please sign in to comment.