Strange "Ghost" Silhouette of Draggable Element When Using Non-integer (i.e., numbers with decimals)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, react
- Domain
- frontend
Research direction
Start with the Draggable component's controlled position handling and reproduce the provided example using decimal x and y values. Trace the drag-start behavior after handleDragStop sets the position, then verify that dragging no longer shows a silhouette when the position contains decimals.
Written by the indexing model from the issue text.
Description
If you set the state of a Draggable element's position to a non-integer (i.e., a number with decimals, like 123.4), you will get a strange silhouette of the element when dragging it. Consider this example:
import { useState } from 'react';
interface PositionModel {
x: number;
y: number;
}
const MyComponent = () => {
const [pos, setPos] = useState({ x: 0, y: 0 } as PositionModel);
const handleDragStop = (_e: DraggableEvent, position: DraggableData) => {
setPos({ x: 456.2, y: 229.8 });
};
return (
<Draggable
position={pos}
onStop={handleDragStop}
>
<div>I am an element</div>
</Draggable>
);
};
After the handleDragStop function is triggered and you go to drag the component again, you'll see something similar to this:
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-grid-layout/react-draggable
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
react-grid-layout/react-draggable#784 · 4 comments · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
react-grid-layout/react-draggable#782 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
react-grid-layout/react-draggable#781 · 1 comment · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
react-grid-layout/react-draggable#780 · 8 comments ·
All issues in react-grid-layout/react-draggable
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·