question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generic Drag&Drop get ctrl, shift, alt and meta key

See original GitHub issue

Description of the feature

I am using the generic Drag&Drop and would like to be able to change the behavior based on the pressed key modifiers. Example: In Windows, draging a file usually moves it, but if you press ctrl, it will copy the file instead. I would like to be able to do the same in Vaadin.

Note:

It seems to be enough to add @EventData("event.ctrlKey") boolean ctrlKey and so on to the constructor of DragEvent (and maybe also the other Drag&Drop related events) and store the result in a member.
For now, I created a custom DragEvent which adds the given information.

Versions:

- Vaadin / Flow version: 19.0.6

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
javier-godoycommented, May 10, 2021

See #7500

0reactions
probert94commented, May 14, 2021

I just noticed, that a few things (like the v-drag-over-target class) are linked to the DropEffect you set on the DropTarget. So solving the related Issue #7500 will probably not be that easy. So I think it wouldn’t be a bad idea to add the KeyModifiers (the related flags) to the dnd events, as it won’t hurt if they are not needed. It’s just an additional information you can use if you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get Ctrl, Shift or Alt with getch() ncurses?
First, for "normal keys" such as the printable ones, you can easily detect shift because it uppercases. For special keys, e.g. KEY_LEFT, you...
Read more >
Reading keyboard ctrlKey (Alt, Shift) state from monitor #512
I would like to modify drop action behavior depending on ctrl button state. E.g. if Ctrl is pressed currently dragged item has to...
Read more >
Control key acts as if it is stuck periodically - Super User
Press both ctrl + shift + alt at the same time including the Fn key (Lenovo). If it still does not work, opening...
Read more >
Key other than Control to send SIG - Unix StackExchange
Modifiers get names and numbers; Control, CapsLock and Shift are always on the same number but the others (Alt, Meta, Hyper, Super, NumLock, ......
Read more >
How do I swap Left Ctrl with Left Alt on my keyboard?
If you start pressing keys on your keyboard you'll get all the key ... Change the Ctrl position option to Swap Left Alt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found