Addition to #2098: only allow search with two or more characters

This commit is contained in:
Konstantin Schaper
2022-08-08 10:51:02 +02:00
parent e48deb8d1d
commit dcd9664e9f

View File

@@ -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