Only dispatch dragStart event if mouse is actually dragging
See original GitHub issueIt would be great if the dragStart event would not fire when the mouse goes down but rather when the cursor actually starts moving. Currently, dragStart and dragEnd will be fired if I only click/touch the slider without moving the cursor.
This would be useful to me because I am currently listening to both click events on items and dragStart/dragEnd Events and change styles accordingly. This leads to the item click having weird effects as it first transitions to the “drag” styles and back before the click event is fired.
I am currently using embla-carousel-react
but I think this is something that concerns all variants of embla.
Let me know if you need an example.
Great Work by the way! 😊
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Only dispatch dragStart event if mouse is actually dragging #22
It would be great if the dragStart event would not fire when the mouse goes down but rather when the cursor actually starts...
Read more >Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
Use event delegation to track drag start: a single event handler on document for mousedown . If elements are dragged to top/bottom window...
Read more >Programmatically fire HTML5 dragstart after mousemove
I have a div that can be dragged using the HTML5 API, but I only want the drag to occur if the user...
Read more >7.7 Drag and drop — HTML5 - W3C
To make an element draggable is simple: give the element a draggable attribute, and set an event listener for dragstart that stores the...
Read more >Part 15 - Drag and Drop (Native and mouse drag ... - YouTube
How to work in Cypress with Drag and Drop(DnD)?1. ... Customized methods on JavaScript Drag and Drop Events fora. HTML N...
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 Free
Top 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
Hi David (@davidjerleke),
thanks for your responses and building this awesome slider! If I had the necessary skills, I’d help you implementing these features…
Good idea, this would serve the purpose for now.
Greetings, Jeff
I’ve taken the unfortunate naming into account and renamed the drag events to pointer events:
dragStart
-->pointerDown
dragEnd
-->pointerUp
This has been implemented and released with version 3.