PuruVJ / neodrag

One Draggable to rule them all 💍
https://neodrag.dev
MIT License
1.59k stars 48 forks source link

Prevent click events from firing on the draggable and/or childs #159

Open houtan-rocky opened 6 months ago

changeset-bot[bot] commented 6 months ago

⚠️ No Changeset found

Latest commit: bcdcedbb64256f197c87b1abff7ff6622889df3e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 6 months ago

@houtan-rocky is attempting to deploy a commit to the Purus Projects Team on Vercel.

A member of the Team first needs to authorize it.

PuruVJ commented 6 months ago

In the example in +page.svelte, if I click on the box, it should just trigger console.log('clicked'), but it doesn't. Similarly, the div inside it should also trigger its click. We only want the dragging to happen alongside the click events.

I think stopping propagation isn't the right step here. Maybe we should harness the delay PR #157, set it to a default of 33-50ms(average duration of a single click) and work with that

Edit: It seems if I press my trackpad fully, it takes 90-100ms for one click. if I just tap it, its less than 10ms. Maybe the default should be 100 🤔 https://stackblitz.com/edit/vitejs-vite-nfx4kq?file=src%2FApp.svelte

houtan-rocky commented 6 months ago

@PuruVJ The type of hold we need to fix this is releaseTimeout, cause the ( unexpected ) click happens after dragEnd ( apparently is default behavior event with vanillajs ), and the delay #157 makes is on dragStart.