Draggable item shifts to the right by a lot when dragging #758
Replies: 3 comments 1 reply
-
From a lot of trial and error and fiddling with that vw number, I came to this result which seems to fix the jankiness to be almost unnoticable. <Draggable draggableId={ind.toString()} index={ind}>
{(provided, snapshot) => {
const style = {
...provided.draggableProps.style,
left: snapshot.isDragging ? '14.85vw' : '0'
};
return (
<div
{...provided.draggableProps}
{...provided.dragHandleProps}
ref={provided.innerRef}
className={'rule mb-4'}
style={style}
>
... I have no idea why that is the magic number, doesn't seem to relate in any way to the 66vw number. Obviously this feels extremely hacky and fragile. If anyone knows of a better fix, I am all ears. |
Beta Was this translation helpful? Give feedback.
-
I have created a sandbox to show what I am talking about. I was able to duplicate it. Open the sliding modal and then try dragging a rule. You will see the rule get shifted to the right. |
Beta Was this translation helpful? Give feedback.
-
Aw, so looks like this is a known issue: #560 |
Beta Was this translation helpful? Give feedback.
-
I am implementing a Drag and Drop functionality inside a modal in my app. The modal slides in from the right side and takes up 66vw. I am guessing that the modal styles, like the transform possibly is what is pushing the draggables over to the right when dragging.
Modal styles:
Here is a screenshot of my modal with 2 drag and drop items in the middle.
And then here is a screenshot of what it looks like when I just start to drag an item, I have not moved it barely at all at this point.
Beta Was this translation helpful? Give feedback.
All reactions