vaadin / vaadin/framework

Vaadin 8.1 DnD: There should be method "setDragImage(Component dragImageComponent)"

Open
#9,762 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Similar to the deprecated DragAndDropWrapper.setDragImageComponent(), there should be a method for the DragSourceExtension which allows us to set a custom component as the drag image. Mozilla clearly states, that

If the node is an HTML img element, an HTML canvas element or a XUL image element, the image data is used. Otherwise, image should be a visible node and the drag image will be created from this. If image is null, any custom drag image is cleared and the default is used instead.

This appears to be easily achieved in JS with dragStartEvent.dataTransfer.setDragImage(componentId, 0, 0);, given that the component has a distinct ID.

And yes, this feature won't work in IE11.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DragSourceExtension and the deprecated DragAndDropWrapper.setDragImageComponent() API, then inspect the dragStartEvent dataTransfer path described in the issue. Done means a custom component can be supplied as the drag image, null restores the default, and the behavior is covered where the existing drag-and-drop functionality is tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.