Skip to content

Commit 97a29ad

Browse files
committed
make the ESC key less agressive and keep input field focus
1 parent 7da933d commit 97a29ad

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/webapp/app/components/primitives/SearchInput.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,12 @@ export function SearchInput({
8080
handleSubmit();
8181
}
8282
if (e.key === "Escape") {
83-
e.stopPropagation();
84-
handleClear();
85-
e.currentTarget.blur();
83+
if (text.length > 0) {
84+
e.stopPropagation();
85+
handleClear();
86+
} else {
87+
e.currentTarget.blur();
88+
}
8689
}
8790
}}
8891
onFocus={() => setIsFocused(true)}

0 commit comments

Comments
 (0)