chore: custom search select input key down improvement (#3787)

This commit is contained in:
Anmol Singh Bhatia 2024-02-26 19:46:00 +05:30 committed by GitHub
parent 888268ac11
commit 67fdafb720
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 56 additions and 0 deletions

View file

@ -80,6 +80,13 @@ export const IssueLabelSelect: React.FC<IIssueLabelSelect> = observer((props) =>
</div>
);
const searchInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (query !== "" && e.key === "Escape") {
e.stopPropagation();
setQuery("");
}
};
if (!issue) return <></>;
return (
@ -118,6 +125,7 @@ export const IssueLabelSelect: React.FC<IIssueLabelSelect> = observer((props) =>
onChange={(e) => setQuery(e.target.value)}
placeholder="Search"
displayValue={(assigned: any) => assigned?.name}
onKeyDown={searchInputKeyDown}
/>
</div>
</div>