Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ca6359f
feat(DraggableCore): Added mobileHoldDelay
zsobecki-futurum Aug 14, 2025
badd6d9
feat(pkg): Added prepare for github link install
zsobecki-futurum Aug 14, 2025
edb1db7
reverted last commit
zsobecki-futurum Aug 14, 2025
bcab60c
chore(pkg): Bumped version
zsobecki-futurum Aug 14, 2025
ab5df91
chore(pkg): Changed package name
zsobecki-futurum Aug 14, 2025
24b2a28
chore(pkg): Another package update
zsobecki-futurum Aug 14, 2025
2054c70
fix(pkg): Fixed package errors
zsobecki-futurum Aug 14, 2025
72e189b
chore(pkg): Changed package name
zsobecki-futurum Aug 14, 2025
a5e4719
chore(pkg): Bumped version
zsobecki-futurum Aug 14, 2025
2e212d1
chore(pkg): Bumped version
zsobecki-futurum Aug 14, 2025
5b68117
feat(mobileDragDelay): Added cancel when user moves during timeframe
zsobecki-futurum Aug 14, 2025
4f399a9
chore(pkg): Bumped version
zsobecki-futurum Aug 14, 2025
f0fd756
feat(handleMobileDrag): Added cancel on user move
zsobecki-futurum Aug 14, 2025
2cd5301
fix(handleMobileDrag): Fixed cancel on user move
zsobecki-futurum Aug 14, 2025
6c3f21d
fix(handleMobileDrag): Fixed cancel on user move 2
zsobecki-futurum Aug 14, 2025
efa7f87
fix(handleMobileDrag): Fixed cancel on user move 3
zsobecki-futurum Aug 14, 2025
6009245
test
zsobecki-futurum Aug 14, 2025
1ed7bb9
test 2
zsobecki-futurum Aug 14, 2025
b8dc998
removed context menu on touch
zsobecki-futurum Aug 14, 2025
52fdade
removed context menu on touch 3
zsobecki-futurum Aug 14, 2025
d44534e
fix: Update version to 4.6.2 and refactor context menu handling in Dr…
zsobecki-futurum Aug 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed context menu on touch 3
  • Loading branch information
zsobecki-futurum committed Aug 14, 2025
commit 52fdade9d845cfd07876a636b451074af24e906c
19 changes: 19 additions & 0 deletions lib/DraggableCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ export default class DraggableCore extends React.Component<DraggableCoreProps> {
addUserSelectStyles(ownerDocument);
}

// Prevent scrolling during drag
addEvent(ownerDocument, 'touchmove', this.preventScroll, {
passive: false,
});

this.dragging = true;
this.lastX = initialX; // Update lastX and lastY only after drag starts
this.lastY = initialY;
Expand Down Expand Up @@ -594,6 +599,13 @@ export default class DraggableCore extends React.Component<DraggableCoreProps> {
dragEventFor.stop,
this.handleDragStop
);
// Remove scroll prevention
removeEvent(
thisNode.ownerDocument,
'touchmove',
this.preventScroll,
{ passive: false }
);
}
};

Expand Down Expand Up @@ -630,6 +642,13 @@ export default class DraggableCore extends React.Component<DraggableCoreProps> {
return false;
};

preventScroll: EventHandler<MouseTouchEvent> = (e) => {
// Prevent scrolling during drag
if (this.dragging) {
e.preventDefault();
}
};

render(): React.Element<any> {
// Reuse the child provided
// This makes it flexible to use whatever element is wanted (div, ul, etc)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zsobecki_futurum/react-draggable",
"version": "4.6.0",
"version": "4.6.1",
"description": "React draggable component with better support for touch events",
"main": "build/cjs/cjs.js",
"unpkg": "build/web/react-draggable.min.js",
Expand Down