Conflict between onDrag and selection SwiftUI

There is a conflict when I use selection and onDrag for a list, onDrag blocks the selection on macOS. I think the problem comes from the fact that selection works on mouseDown and the same for onDrag. So, when the mouseDown event is triggered, swiftUI call the last modifier which is onDrag and it doesn't trigger the selection anymore.

When I check on the Finder app, I noticed that the selection is triggered on mouseUp, which confirms my theory. Moreover, on finder, they combine onDrag, selection, and doubleClick without any conflict. Therefore, I'm pretty sure there is a workaround, but I can't figure it out...

Did anyone already face this issue and found a workaround?

I worked around this exact problem by adding this below the .onDrag modifier:

.onTapGesture { $mySelection = thisThing }

/shrug

Conflict between onDrag and selection SwiftUI
 
 
Q