Is it possible to detect the status of control key in drop event so that I can copy instead of move if ctrl is being pressed?
I saw some solutions but they’re all for Framework 8, but I’m using Vaadin Flow 24.
Is it possible to detect the status of control key in drop event so that I can copy instead of move if ctrl is being pressed?
I saw some solutions but they’re all for Framework 8, but I’m using Vaadin Flow 24.
Looks this is an open issue in Flow: Generic Drag&Drop get ctrl, shift, alt and meta key · Issue #10956 · vaadin/flow · GitHub However there is one possible workaround, you can “monkey patch” the com.vaadin.flow.component.dnd.DropEvent:
com.vaadin.flow.component.dnd
into your project private final boolean altKey;
private final boolean shiftKey;
private final boolean ctrlKey;
public DropEvent(T source, boolean fromClient,
@EventData("event.dataTransfer.effectAllowed") String effectAllowed,
@EventData("event.altKey") boolean altKey,
@EventData("event.shiftKey") boolean shiftKey,
@EventData("event.ctrlKey") boolean ctrlKey) {
super(source, fromClient);
this.altKey = altKey;
this.shiftKey = shiftKey;
this.ctrlKey = ctrlKey;
// rest of the constructor...
}
In Mac and Chrome at least the shift key’s boolean status was correctly resolved in my dropTarget.addDropListener.