dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

Weird Styling behaviour of draggable on passing sensor activator options.

Open gurpreet013 opened this issue 1 year ago • 3 comments

Why i am using this packages? Very simple use case. In my application i have multiple cards which any user can drag and drop to another section.

  1. Scenario 1 - Passing no Constraints to the sensor.
  2. Scenario 1 - Passing Constraints to the sensor.

Scenario 1

  • If i have passed any sensor i.e. Pointer, Mouse Touch or keyboard without any constraint like delay or distance then dragging and draggable item styling is working fine but I have multiple CTA's on card which are not working now as i didn't passed any constraints as soon as i click on them the Dragging event starts. Scenario 1 is working as expected as i am not passing any constraint.

Attaching screenshots have a look at the values that i am getting inside onDragStart Image 2022-07-28 at 4 06 55 PM Screen Recording 2022-07-28 at 04 05 PM

Scenario 2

  • If i passed any of the constraint in sensors in that case the draggable card top, left, bottom, width, height of draggable set to 0 and dragging start from that position which is weird. Attaching screenshots Image 2022-07-28 at 3 57 29 PM

Screen Recording 2022-07-28 at 04 04 PM

I am not sure why in scenario 2 the styling of draggable item is set to zero. Can you guys help me whether its something that i am doing wrong or there is a bug present in this scenario.

gurpreet013 avatar Jul 28 '22 10:07 gurpreet013

Hi @clauderic, Can you have a look at the above scenarios and help me in resolving this problem?

gurpreet013 avatar Jul 28 '22 10:07 gurpreet013

Hi @gurpreet013, could you provide a CodeSandbox replicating the issue you are facing?

clauderic avatar Jul 28 '22 18:07 clauderic

We are having the same issue. In our scenario we use a virtualised list which positions all elements at top:0 left:0 and translates them to their actual position. Using a mouse sensor with distance constrains breaks this solution. I hope i find the time to create a minimal example this week.

clarknova avatar Aug 08 '22 08:08 clarknova