Skip to content
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

Detect drag-and-drop cancellation when user pressed the Escape key #21908

Closed
arviedelgado opened this issue May 16, 2020 · 1 comment
Closed
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved

Comments

@arviedelgado
Copy link

Describe the bug

On a drag and drop operation, the user can cancel the operation by pressing the Escape key.
The value of DragEventArgs.DataTransfer.DropEffect will be none in the @ondragend event.
However, DragEventArgs.DataTransfer.DropEffect is null.

To Reproduce

<div ondragover="event.preventDefault();" style="...">
    <div draggable="true" @ondragend=OnDragEnd style="..." />
</div>

private void OnDragEnd(DragEventArgs e)
{
	if (e.DataTransfer.DropEffect == "none") // but DropEffect is null
	{
		// the user cancelled the drag operation,
		// by pressing Escape key.
	}
}
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label May 16, 2020
@mkArtakMSFT
Copy link
Member

Thanks for contacting us. At the moment, Drag & Drop is not supported out of the box, so you have to write your own JSInterop logic to handle this, hence handling the Escape key.

We do plan to bring support for Drag & Drop as part of #18754

@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label May 18, 2020
@ghost ghost added the Status: Resolved label May 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants