clear search input on Escape

This commit is contained in:
Matt Dunn-Rankin 2020-04-22 04:07:34 -07:00
parent 255b77d0cf
commit 43f85aaf96

View file

@ -136,6 +136,12 @@ function SearchToolbar({ query, onChange }) {
color="green.800" color="green.800"
value={query} value={query}
onChange={(e) => onChange(e.target.value)} onChange={(e) => onChange(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Escape") {
onChange("");
e.target.blur();
}
}}
/> />
{query && ( {query && (
<InputRightElement> <InputRightElement>