Merge pull request #423 from chrisvel/fix-dialog-hide

Fix modal closing when dragging content
This commit is contained in:
Chris 2025-10-20 10:54:13 +03:00 committed by GitHub
commit 1d1d07059c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -439,8 +439,9 @@ const ProjectModal: React.FC<ProjectModalProps> = ({
className={`fixed top-16 left-0 right-0 bottom-0 flex items-start sm:items-center justify-center bg-gray-900 bg-opacity-80 z-40 transition-opacity duration-300 ${
isClosing ? 'opacity-0' : 'opacity-100'
}`}
onClick={(e) => {
onMouseDown={(e) => {
// Close modal when clicking on backdrop, but not on the modal content
// Use mousedown instead of onClick to prevent issues with text selection dragging
// Also prevent immediate closes after modal opens
if (e.target === e.currentTarget && !modalJustOpened) {
handleClose();

View file

@ -461,8 +461,9 @@ const TaskModal: React.FC<TaskModalProps> = ({
className={`fixed top-16 left-0 right-0 bottom-0 bg-gray-900 bg-opacity-80 z-40 transition-opacity duration-300 overflow-hidden sm:overflow-y-auto ${
isClosing ? 'opacity-0' : 'opacity-100'
}`}
onClick={(e) => {
onMouseDown={(e) => {
// Close modal when clicking on backdrop, but not on the modal content
// Use mousedown instead of onClick to prevent issues with text selection dragging
if (e.target === e.currentTarget) {
handleClose();
}
@ -470,8 +471,9 @@ const TaskModal: React.FC<TaskModalProps> = ({
>
<div
className="h-full flex items-start justify-center sm:px-4 sm:py-4"
onClick={(e) => {
onMouseDown={(e) => {
// Close modal when clicking on centering container, but not on the modal content
// Use mousedown instead of onClick to prevent issues with text selection dragging
if (e.target === e.currentTarget) {
handleClose();
}