From dcd9664e9f9f073c989d9d54f0b6db052a8aa76c Mon Sep 17 00:00:00 2001 From: Konstantin Schaper Date: Mon, 8 Aug 2022 10:51:02 +0200 Subject: [PATCH] Addition to #2098: only allow search with two or more characters --- scm-ui/ui-webapp/src/containers/OmniSearch.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scm-ui/ui-webapp/src/containers/OmniSearch.tsx b/scm-ui/ui-webapp/src/containers/OmniSearch.tsx index 1566173a5e..85bb3aad8e 100644 --- a/scm-ui/ui-webapp/src/containers/OmniSearch.tsx +++ b/scm-ui/ui-webapp/src/containers/OmniSearch.tsx @@ -210,16 +210,18 @@ const useKeyBoardNavigation = ( }); break; case 13: // e.code: Enter - if (index < 0) { - history.push(defaultLink); - } else { - const entry = entries[index]; - if (entry?.props.link) { - history.push(entry.props.link); + if ((e.target as HTMLInputElement).value.length >= 2) { + if (index < 0) { + history.push(defaultLink); + } else { + const entry = entries[index]; + if (entry?.props.link) { + history.push(entry.props.link); + } } + clear(); + hideResults(); } - clear(); - hideResults(); break; case 27: // e.code: Escape