diff --git a/web/components/inbox/modals/create-edit-modal/create-root.tsx b/web/components/inbox/modals/create-edit-modal/create-root.tsx index 08743f63c..36f1b0abe 100644 --- a/web/components/inbox/modals/create-edit-modal/create-root.tsx +++ b/web/components/inbox/modals/create-edit-modal/create-root.tsx @@ -81,7 +81,7 @@ export const InboxIssueCreateRoot: FC = observer((props) const handleFormSubmit = async (event: FormEvent) => { event.preventDefault(); - if (descriptionEditorRef.current?.isEditorReadyToDiscard()) { + if (!descriptionEditorRef.current?.isEditorReadyToDiscard()) { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", diff --git a/web/components/issues/issue-modal/form.tsx b/web/components/issues/issue-modal/form.tsx index 1d91e687e..9313f8f77 100644 --- a/web/components/issues/issue-modal/form.tsx +++ b/web/components/issues/issue-modal/form.tsx @@ -122,7 +122,7 @@ export const IssueFormRoot: FC = observer((props) => { const { getProjectById } = useProject(); const { areEstimatesEnabledForProject } = useEstimate(); - function handleKeyDown(event: KeyboardEvent) { + const handleKeyDown = (event: KeyboardEvent) => { if (editorRef.current?.isEditorReadyToDiscard()) { onClose(); } else { @@ -133,7 +133,7 @@ export const IssueFormRoot: FC = observer((props) => { }); event.preventDefault(); // Prevent default action if editor is not ready to discard } - } + }; useKeypress("Escape", handleKeyDown);