From 576063ffe9a399a01cbd1614fdfec63eb8a7676d Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Sun, 2 Jun 2024 22:52:34 -0400 Subject: [PATCH] Update search_input.tsx --- components/neroshitron/search_input.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/neroshitron/search_input.tsx b/components/neroshitron/search_input.tsx index 6225c03..69247b3 100644 --- a/components/neroshitron/search_input.tsx +++ b/components/neroshitron/search_input.tsx @@ -72,6 +72,13 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable const newIndex = currentIndex === tags.length - 1 ? 0 : currentIndex + 1; setCurrentTag(tags[newIndex].name); } + else if(event.key === 'Enter'){ + const currentIndex = tags.findIndex(tag => tag.name === currentTag); + setSelectedTags([...selectedTags, tags[currentIndex].name]); + const tagsInput = selectedTagsInput; + tagsInput.push({value: tags[currentIndex].name, label: tags[currentIndex].name}); + setSelectedTagsInput(tagsInput); + } }; window.addEventListener('keydown', handleKeyDown);