chore: custom search select input key down improvement (#3787)
This commit is contained in:
parent
888268ac11
commit
67fdafb720
7 changed files with 56 additions and 0 deletions
|
|
@ -249,6 +249,13 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
|
|||
toggleDropdown();
|
||||
};
|
||||
|
||||
const searchInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (query !== "" && e.key === "Escape") {
|
||||
e.stopPropagation();
|
||||
setQuery("");
|
||||
}
|
||||
};
|
||||
|
||||
useOutsideClickDetector(dropdownRef, handleClose);
|
||||
|
||||
const comboboxProps: any = {
|
||||
|
|
@ -349,6 +356,7 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
|
|||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search"
|
||||
displayValue={(assigned: any) => assigned?.name}
|
||||
onKeyDown={searchInputKeyDown}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 max-h-48 space-y-1 overflow-y-scroll">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue