mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: close modal on Esc press
This commit is contained in:
parent
c82109a5bb
commit
d7ab50846d
1 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue