[Mac Catalyst] Drag and drop does not work in multi-window application
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
https://github.com/MartyIX/maui/tree/feature/2025-03-18-Drag-n-Drop-between-two-windows (commit https://github.com/MartyIX/maui/commit/3650717c)
Demonstrates that drag and drop between two windows leads to _not having access to the dragged item data_ (i.e. `DropEventArgs.Data.Properties is empty`):
https://github.com/user-attachments/assets/c3793a1b-464b-449a-95d7-a375250477b1
The expectation is that I would see the message "YEY. DRAGGED OBJECT WAS FOUND" but it does not happen.
I did research this issue a bit and the reason why "dragging an object from one app's window to another app's window (of the same app)" is because this condition is not true:
https://github.com/dotnet/maui/blob/7e7ae0815716c0c6ce040aaa8ea3e7b0da6b148d/src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs#L120
Not because there is a bug in the code (AFAIK), but because `session.LocalDragSession` is `null`, consequently `cdi.DataPackage` is not propagated.
My best guess is that Mac Catalyst API (UIKIT) thinks that one drags an object from a different app even though it's not true. I wonder if there is possibly some switch or permission that affects this -- I did search for it but I tend to believe there is not such an option.
### Link to public reproduction project repository
https://github.com/MartyIX/maui/tree/feature/2025-03-18-Drag-n-Drop-between-two-windows
See also https://github.com/dotnet/maui/issues/12510#issuecomment-1619797599
### Version with bug
9.0.50 SR5
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
Unknown/Other
### Affected platforms
macOS, I was *not* able test on other platforms
### Affected platform versions
_No response_
### Did you find any workaround?
No.
### Relevant log output
```shell
```
Contributor guide
Research direction
Start with src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs at the linked condition involving session.LocalDragSession, then run the linked reproduction project on Mac Catalyst. Trace why cdi.DataPackage is not propagated between windows and verify the fix by confirming DropEventArgs.Data.Properties contains the dragged item and the expected message appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, ios, macos
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100