mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 08:43:48 +03:00
feat: close modal on Esc press
This commit is contained in:
parent
9a4b8f2f67
commit
dbdb36999d
@ -38,6 +38,16 @@ export function Modal({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const close = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
handleCloseClick();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener("keydown", close);
|
||||||
|
return () => window.removeEventListener("keydown", close);
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(toggleDragging(visible));
|
dispatch(toggleDragging(visible));
|
||||||
}, [dispatch, visible]);
|
}, [dispatch, visible]);
|
||||||
|
Loading…
Reference in New Issue
Block a user