react-beautiful-dnd icon indicating copy to clipboard operation
react-beautiful-dnd copied to clipboard

Unable to drag with the mouse while Ctrl button is pressed

Open inkas opened this issue 5 years ago • 9 comments

Expected behavior

While holding the Ctrl button you should be able to drag with the mouse

Actual behavior

When a Ctrl button is pressed the mouse dragging is disabled. Instead, only a focus is added to the draggable

Steps to reproduce

Press and hold the Ctrl button and try to drag with the mouse

Suggested solution?

I couldn't find any documentation for manual key mapping. It would be great if I could somehow detect a mouse drag while Ctrl button is being pressed. I want to do copy of the draggable if Ctrl is pressed, otherwise simply move it to the droppable column.

What version of React are you using?

16.12.0

What version of react-beautiful-dnd are you running?

12.2.0

What browser are you using?

Chrome 79

Demo

dnd

inkas avatar Dec 20 '19 08:12 inkas

Right now we do not allow dragging if button is pressed when the mouse down occurs. This is done in order to try and play well with other browser interactions.

Just so I understand, you would like there to be some way to add a keyboard modifier to dragging?

alexreardon avatar Jan 09 '20 06:01 alexreardon

Exactly. But disabled dragging while a key is pressed is the main issue. I thought disabling keyboard dragging will solve this issue, however it can not be disabled at this point #1683

inkas avatar Jan 09 '20 10:01 inkas

I hope that will be resolved soon ^

alexreardon avatar Jan 10 '20 01:01 alexreardon

Just to add to this - I think the code blocking drag starting while modifier key is pressed is here: https://github.com/atlassian/react-beautiful-dnd/blob/24a8e6021600920c0b2a28f89d5ffb17538fe96c/src/view/use-sensor-marshal/sensors/use-mouse-sensor.js#L227

I'm implementing a multi drag and drop solution using react-beautiful-dnd, and everything is working great, but it would be extra awesome if we could have the drop start while user is still holding down Shift or Ctrl/Cmd, to align more with other drag and drop scenarios. We could add custom sensors I think? But really only want to change that one line in the one sensor. Maybe if sensors were exported, and there was a param configurable in the mouse sensor, that would be the best solution: https://github.com/atlassian/react-beautiful-dnd/issues/1698

mofojed avatar Sep 18 '20 14:09 mofojed

Any updates on this? I've been struggling with this for a few days. I tried reimplementing my own mouse sensor without this line with no success.

Furthermore, I thought that this code would allow pressing other keys while dragging, but it doesn't seem to be the case. When pressing "a" for example, the dragging is blocked just like when pressing CTRL. I did it just like it was suggested here #1683

<DragDropContext
	onDragEnd={res => onDragged(res)}
	enableDefaultSensors={true}
	sensors={[useMouseSensor]}
>

EnglederLucas avatar Sep 06 '21 07:09 EnglederLucas

Right now we do not allow dragging if button is pressed when the mouse down occurs. This is done in order to try and play well with other browser interactions.

Just so I understand, you would like there to be some way to add a keyboard modifier to dragging?

Hi @alexreardon - is this keyboard modifier to allow dragging done? I would like to do Ctrl + click to drag and copy

NaagAI avatar May 08 '24 08:05 NaagAI

I tried doing 'isdragdisabled'= FALSE when CTRL key is pressed but still no luck. Can you please help @alexreardon ?

NaagAI avatar May 08 '24 09:05 NaagAI

I hope that will be resolved soon ^

Hi @alexreardon - please let us know if you had time to review/resolve this? Badly in need of this feature

NaagAI avatar May 13 '24 09:05 NaagAI

There is still no solution for this case?

Alex3496 avatar Jul 10 '24 22:07 Alex3496