Skip to content

Commit

Permalink
enabled escape key press for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nawabfurquan committed Feb 13, 2025
1 parent 3ed6712 commit 1c124f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/charts/dialogs/FileUploadDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1453,17 +1453,6 @@ const FileUploadDialogComponent: React.FC<FileUploadDialogComponentProps> =

const Wrapper = (props: FileUploadDialogComponentProps) => {
const [open, setOpen] = useState(true);
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === "Escape") {
setOpen(false);
}
};
window.addEventListener("keydown", handleKeyDown);
return () => {
window.removeEventListener("keydown", handleKeyDown);
};
}, []);

const handleClose = () => {
setOpen(false);
Expand Down
7 changes: 6 additions & 1 deletion src/charts/dialogs/ReusableDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Close } from "@mui/icons-material";
import { Container, Dialog, IconButton, Paper } from "@mui/material";
import { useEffect } from "react";

export interface ReusableDialogProps {
open: boolean;
Expand All @@ -12,12 +13,16 @@ const ReusableDialog = ({
handleClose,
component,
}: ReusableDialogProps) => {
useEffect(() => {
console.log("render");
});

return (
<Dialog
open={open}
onClose={handleClose}
fullScreen
disableEscapeKeyDown={true}
disableRestoreFocus
PaperProps={{
style: {
backgroundColor: "var(--fade_background_color)",
Expand Down

0 comments on commit 1c124f5

Please sign in to comment.