Ability to delay dragging event by X milliseconds
See original GitHub issueBug, feature request, or proposal:
Feature request
What is the expected behavior?
Set property to delay dragging event by X milliseconds
<div cdkDrag cdkDragDelay="2000">Hold for 2 seconds to move this item</div>
What is the current behavior?
No option to prevent dragging on initial touch rendering this very hard to use on mobile. (This is certainly not helped by the fact that cdkDrag elements disable mobile scroll events)
What is the use-case or motivation for changing an existing behavior?
Currently click events immediately trigger leading to unintended re-ordering. Many sites and native devices solves this issue by not starting the drag event unless user have clicked and hold the object for a short amount of time.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/cdk: 7.0.2
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top Results From Across the Web
c# - Timer firing Tick event with 15 milliseconds delay
Any timers that I create, fire their tick event with 15 or 16 milliseconds delay. For instance, if I set the interval of...
Read more >Common Action Options - interact.js
The action will start after the pointer is held down for the given number of milliseconds. inertia. Change inertia settings for drag, and...
Read more >Handling Events :: Eloquent JavaScript
For example, we might want to respond to "mousemove" events by showing the current coordinates of the mouse but only every 250 milliseconds....
Read more >HTML Drag and Drop API - MDN Web Docs
HTML drag-and-drop uses the DOM event model and drag events inherited ... dragged over a valid drop target, every few hundred milliseconds.
Read more >Drag and Drop | Angular Material
Distance the user has dragged since the start of the dragging sequence. event. MouseEvent | TouchEvent = {} as any. Event that triggered...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I +1 this idea. I’d also suggest that in that case the px threshold should be bypassed so the user gets the drag preview right after the long-press (without the need to drag) to get immediate feedback that dragging is now enabled.
On the other hand a custom solution could probably be created once #13722 is merged. You’d then just manually need to handle the long-press and after that enable the dragging of that element.
Or you could use separate drag handles that are only active and visible on mobile devices.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.