Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: closing dialogs on touch screens

Ilian Sapundshievdb4a12207001
diff --git a/src/renderer/components/DraggablePaper.tsx b/src/renderer/components/DraggablePaper.tsx
index b0c5a8cc9..f6ca2746e 100644
--- a/src/renderer/components/DraggablePaper.tsx
+++ b/src/renderer/components/DraggablePaper.tsx
@@ -24,7 +24,14 @@ function DraggablePaper(props: PaperProps) {
return (
<Draggable
handle="#draggable-dialog-title"
- cancel={'[class*="MuiDialogContent-root"]'}
+ // Exclude the dialog body and any buttons living in the draggable title
+ // (close, back, action slots) from initiating a drag. On touch devices
+ // react-draggable calls preventDefault() on `touchstart` once a drag
+ // starts, which cancels the synthesized click — so without this the
+ // title-bar close button never fires `onClose`. Matching `cancel` makes
+ // react-draggable bail out before that preventDefault, letting the tap
+ // through.
+ cancel={'[class*="MuiDialogContent-root"], button'}
>
<Paper {...props} />
</Draggable>