Repository navigation
fix: Drag preview visibility - #976
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Collaborator
|
Nice find! I think the workaround is ok. What did we previously use to move the element off screen? I'm curious if a translate transform would work |
Collaborator
Author
Not quite, I'm still encountering issues with the DO code block:( So the opacity fix seems like the way to go |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Even though we've tried different approaches, we still keep seeing people have issues with the drag preview. Here's a summary of the things we've tried before and why they weren't ideal:
Displaying the drag preview element off-screen
This is recommended by Mozilla:
It works for most cases but isn't 100% reliable, as it causes bugs with some apps (@YousefED this was specifically an issue with DeepOrigin). Typically the issue is that the drag preview cuts off whatever part of the element is not within bounds of the screen.
Setting a negative drag preview z-index
This again works for most cases but not all, as the element will still be visible through any UI components that aren't fully opaque. See #966 for examples of this.
This PR makes the drag preview element get displayed at the top of the page with a very low opacity, which seems to be a more reliable fix than the previous approaches. Opacity has no effect of the drag preview itself unless the value is 0, in which case it becomes invisible. However, it works as expected for the drag preview element. This means that setting a very low opacity value makes the element functionally invisible without changing the drag preview at all. While this is a hack, it still seems to work better than the previous approaches, even though one of them is officially recommended.
Closes #966