fix esc handler
This commit is contained in:
@ -44,14 +44,8 @@ export default function SearchBox() {
|
|||||||
setSearch("");
|
setSearch("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const inputElement = resultListRef.current?.previousSibling as HTMLElement;
|
|
||||||
|
|
||||||
inputElement?.addEventListener("focus", () => {
|
document.addEventListener("keydown", handleGlobalKeyDown);
|
||||||
document.addEventListener("keydown", handleGlobalKeyDown);
|
|
||||||
});
|
|
||||||
inputElement?.addEventListener("blur", () => {
|
|
||||||
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("keydown", handleGlobalKeyDown);
|
document.removeEventListener("keydown", handleGlobalKeyDown);
|
||||||
|
Reference in New Issue
Block a user