Fix unexpected unkown options recognition
Summary: #thanks LukeDefeo for helping to debug power search Before: https://pxl.cl/3JFqq Reviewed By: LukeDefeo, lblasa Differential Revision: D50884084 fbshipit-source-id: 4cf76a73704cda3627b3bb5ab170d6e76df977cf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6d3ff9d5d9
commit
b4f77da11a
@@ -65,20 +65,20 @@ export const PowerSearchTermFinder = React.forwardRef<
|
|||||||
onChange={setSearchTermFinderValue}
|
onChange={setSearchTermFinderValue}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
setSearchTermFinderValue(null);
|
setSearchTermFinderValue(null);
|
||||||
}}
|
|
||||||
onInputKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
if (searchTermFinderValue && onConfirmUnknownOption) {
|
|
||||||
onConfirmUnknownOption(searchTermFinderValue);
|
|
||||||
}
|
|
||||||
setSearchTermFinderValue(null);
|
|
||||||
}
|
|
||||||
if (event.key === 'Backspace' && !searchTermFinderValue) {
|
|
||||||
onBackspacePressWhileEmpty();
|
|
||||||
}
|
|
||||||
}}>
|
}}>
|
||||||
<Input
|
<Input
|
||||||
bordered={false}
|
bordered={false}
|
||||||
|
onKeyUp={(event) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
if (searchTermFinderValue && onConfirmUnknownOption) {
|
||||||
|
onConfirmUnknownOption(searchTermFinderValue);
|
||||||
|
}
|
||||||
|
setSearchTermFinderValue(null);
|
||||||
|
}
|
||||||
|
if (event.key === 'Backspace' && !searchTermFinderValue) {
|
||||||
|
onBackspacePressWhileEmpty();
|
||||||
|
}
|
||||||
|
}}
|
||||||
onPasteCapture={(event) => {
|
onPasteCapture={(event) => {
|
||||||
const text = event.clipboardData.getData('text/plain');
|
const text = event.clipboardData.getData('text/plain');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user