-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Safari native drag preview on elements with image #66
Comments
Thanks for raising this! Could you please port your example to https://codesandbox.io/ (or similar) so I can have a play? |
Hi @alexreardon, sure and thank you for your time! https://codesandbox.io/p/sandbox/wizardly-rgb-jpw5kg?file=%2Fsrc%2Findex.tsx It's a minimal example without styling or anything involved. I kept it simple in order to not introduce other problems which might have some other reason. I personally use the example within a flexbox, though the issue already happens without one. Please try with Safari on Mac. Chrome works perfect and also Firefox quite fine (preview is smaller but still visible) Also one thing to mention (not sure if you also have it in the docs) is that I would really recommend putting Hope this helps! |
Seems like a workaround would be wrapping the <DraggableItem className='my-classname' onDragEnd={console.log}>
<div>
<img src='somesource.jpg' onClick={()=> setSomeState(true)} draggable={false} />
</div>
</DraggableItem> You could even use an Update: This workaround, however, removes the image from the drag preview in Firefox on the first drag after page load. |
I experience a bug, in Safari, where when I drag an element with an image, the native drag preview is not working as expected.
I have an implementation like this: (simplified version - only the last lines are really relevant to understand the issue)
As pointed out in the documentation I need to set
draggable="false"
on the image in order for the functionality to work. However, with this change in Safari, the snapshot of the drag preview is simply empty and does not include the image. It does though render the element wrapping the image as a drag preview but without including the image.Did someone experience this before and might have a workaround for it. It seems to work fine on Chrome and Firefox. Thank you!
The text was updated successfully, but these errors were encountered: