diff --git a/desktop/flipper-plugin/src/ui/PowerSearch/index.tsx b/desktop/flipper-plugin/src/ui/PowerSearch/index.tsx index 9bdcc7212..38108fe6c 100644 --- a/desktop/flipper-plugin/src/ui/PowerSearch/index.tsx +++ b/desktop/flipper-plugin/src/ui/PowerSearch/index.tsx @@ -71,6 +71,10 @@ export const PowerSearch: React.FC = ({config}) => { ? searchExpression[searchExpression.length - 1].searchValue !== undefined : false; + const [searchTermFinderValue, setSearchTermFinderValue] = React.useState< + string | null + >(null); + return (
@@ -111,8 +115,8 @@ export const PowerSearch: React.FC = ({config}) => { ]; }); }} - onKeyUp={(event) => { - if (event.key === 'Enter') { + onKeyDown={(event) => { + if (event.key === 'Enter' || event.key === 'Escape') { event.currentTarget.blur(); } }} @@ -153,12 +157,23 @@ export const PowerSearch: React.FC = ({config}) => { operator: operatorConfig, }, ]); + setSearchTermFinderValue(null); }} filterOption={(inputValue, option) => { return !!option?.label .toLowerCase() .includes(inputValue.toLowerCase()); }} + value={searchTermFinderValue} + onChange={setSearchTermFinderValue} + onBlur={() => { + setSearchTermFinderValue(null); + }} + onInputKeyDown={(event) => { + if (event.key === 'Enter') { + setSearchTermFinderValue(null); + } + }} />
);