[WEB-4041] chore: modal outside click behaviour #7072

This commit is contained in:
Anmol Singh Bhatia 2025-05-18 15:18:09 +05:30 committed by GitHub
parent 5b776392bd
commit 6c483fad2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 18 deletions

View file

@ -13,6 +13,7 @@ import { ModuleForm } from "@/components/modules";
// constants
// hooks
import { useEventTracker, useModule, useProject } from "@/hooks/store";
import useKeypress from "@/hooks/use-keypress";
import { usePlatformOS } from "@/hooks/use-platform-os";
type Props = {
@ -142,8 +143,12 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
setActiveProject(projectId ?? workspaceProjectIds?.[0] ?? null);
}, [activeProject, data, projectId, workspaceProjectIds, isOpen]);
useKeypress("Escape", () => {
if (isOpen) handleClose();
});
return (
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.TOP} width={EModalWidth.XXL}>
<ModalCore isOpen={isOpen} position={EModalPosition.TOP} width={EModalWidth.XXL}>
<ModuleForm
handleFormSubmit={handleFormSubmit}
handleClose={handleClose}