mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: close modal on Esc press
This commit is contained in:
parent
c82109a5bb
commit
d7ab50846d
@ -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(() => {
|
||||
dispatch(toggleDragging(visible));
|
||||
}, [dispatch, visible]);
|
||||
|
Loading…
Reference in New Issue
Block a user